【发布时间】:2015-04-02 15:49:32
【问题描述】:
下面的函数给出了设备中当前时间的unixtime
public static long get_unix_time2(long seconds_since_midnight_gmt,
int day_of_month) {
long m_time = 0;
Calendar cal = Calendar.getInstance();
cal.set(Calendar.MONTH, cal.get(Calendar.MONTH));
cal.set(Calendar.YEAR, cal.get(Calendar.YEAR));
cal.set(Calendar.DAY_OF_MONTH, day_of_month);
m_time = cal.getTime().getTime();
//Date current = Calendar.getInstance().getTime();
//Date dateTime = new Date();
//long diffInSeconds = (current.getTime() - dateTime.getTime()) / 1000;
//long min = (diffInSeconds = (diffInSeconds / 60)) >= 60 ? //diffInSeconds % 60
// : diffInSeconds;
// m_time = m_time - (min * -3600 * 1000);
return m_time;
}
如何更改 unixtime,以便将来自设备的时间替换为作为参数接收的“seconds_since_midnight_gmt”值。
【问题讨论】:
标签: java blackberry unix-timestamp gmt