flex java 1900 時間倒流


public class DateTest {

public static void main(String[] args) {
Calendar calendar = Calendar.getInstance();
calendar.clear();
calendar.set(Calendar.YEAR, 1900);
calendar.set(Calendar.HOUR, 7);
for (int i = 420; i < 1440; i++) {
Date date = calendar.getTime();
System.out.println(date);
System.out.println(date.getTime());
calendar.add(Calendar.MINUTE, 1);
}
}
}


如果執行這段代碼會發現結果是CST格式,7:59分之後時間跳躍了5:52。數據庫中我有個字段是time類型,經過blazeds和flex傳遞後,數據庫中的8:00,在客戶端顯示不正確,因此必須使用如下代碼,精確到分鐘

if (time >= -2208988740000) {
date.setTime(time + 352000);
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章