Date&Time in java codes&XML
2007-07-29 17:44
351 查看
Date&Time in java codes&XML
Problem DescriptionThe 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
相关文章推荐
- File transfer & File rename & Folder creation in java codes
- Oracle Database 10g XML & SQL: Design, Build & Manage XML Applications in Java, C, C++ & PL/SQL
- Java Basics Part 15/20 - Date & Time
- java.lang.RuntimeException: Date pattern must be set for column update_time in the schema of component
- DatePicker&&TimePicker In DialogFragment
- Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xmlbeans/XmlObject
- java学习记录(3)-- Java8日期API LocalDate & LocalTime &Junit
- Simple trick to convert Date format with timezone in Java!
- 问题解决:java.sql.SQLException:Value '0000-00-00' can not be represented as java.sql.Date
- XML&Java&XMLBeans结合应用的价值
- Understand <Java Concurrency in Practice>
- 【小平工作日志】java 异常absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml
- Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/mail/util/Lin
- java使用System.currentTimeMillis()获取当前时间戳而不要用new Date()
- Exception in thread "main" java.lang.UnsupportedClassVersionError:
- Android基础:Date & Time组件(下)
- Java&Xml教程(十一)JAXB实现XML与Java对象转换
- Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
- Exception in thread "main" org.hibernate.InvalidMappingException: Unable to read XML
- maven使用jstl表达式和The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application解决