您的位置:首页 > 编程语言 > Java开发

Date&Time in java codes&XML

2007-07-29 17:44 351 查看

Date&Time in java codes&XML

Problem Description
The path of the Time is,

Java.util.Date --> XML: datetime --> Java.util.Calendar.getTime()

If we have not done any additional change for the Time functions, the result in the end will be many hours away from the actual time.

One possible Solution


java.util.Date nowdate=new java.util.Date();


nowdate.setTime(nowdate.getTime()-nowdate.getTimezoneOffset()*60*1000);

ps: getTimezoneOffset(): unit is minute
setTime() and getTime(): unit is millisecond


Calendar CaseStartDate = srs.getCaseDateInfo().getCaseStartDate();


nowdate=CaseStarDate.getTime();// Get day and time
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐