Java:Timezonewhydifferenttimezonegivesamevalueinmillisec引用上面的链接,我假设Calendar类的getTimeInMillis()返回独立于时区的毫秒数。但是使用下面的代码:Calendarcal=Calendar.getInstance();intdateInSeconds=(int)(cal.getTimeInMillis()/1000);Log.i("TIMEINSECONDS:",""+dateInSeconds);起初尝试将我的系统时钟设置为10:00和GMT+02:00产生一定的输出数量。但是将系统时钟设置为10:0
这是我的约会对象ThuFeb2018:34:00GMT+5:302014当我使用getTimeInMillis()时,我得到一个负值(-5856679776000)。它应该是积极的东西。谁能告诉我为什么?存储日期即cal1给出负值,而第二个日期即当前日期为正值。SimpleDateFormatformat=newSimpleDateFormat("yyyy-MM-ddHH:mm:ss",java.util.Locale.getDefault());try{java.util.Dated=format.parse(date+""+time);GregorianCalendarcal1=n
我有一个timeInMillis值,我知道我可以从中得到一个Date类似的东西;SimpleDateFormatformatter=newSimpleDateFormat("dd/MM/yyyy");StringdateString=formatter.format(newDate(dateInMillis)));我正在使用DataBinding来填充RecyclerView。我也知道在使用DataBinding时可以操作字符串;android:text='@{String.format("%.1f",example.double)}'但是,我无法确定如何使用timeInMillis值
我有一个timeInMillis值,我知道我可以从中得到一个Date类似的东西;SimpleDateFormatformatter=newSimpleDateFormat("dd/MM/yyyy");StringdateString=formatter.format(newDate(dateInMillis)));我正在使用DataBinding来填充RecyclerView。我也知道在使用DataBinding时可以操作字符串;android:text='@{String.format("%.1f",example.double)}'但是,我无法确定如何使用timeInMillis值