Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Date class related query

 
Vishal Hegde
Ranch Hand
Posts: 1077
Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
James Sabre
Ranch Hand
Posts: 781
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
java.util.Date holds the date as the number of milliseconds since the epoch of 1/1/1970 00:00:00 UTC. The constructor you are using is using the value you provide as this millisecond value so '2' means 1/1/1970 00:00:02 UTC. The toString() method uses your current time zone when converting the milliseconds to a String.
 
Mohamed El-Feky
Greenhorn
Posts: 19
Eclipse IDE Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
absolutely right

you might try to use different constructor to get diff response
 
Rob Spoor
Sheriff
Pie
Posts: 20532
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Almost right. Not 1/1/1970 00:00:02 UTC but 1/1/1970 00:00:00.002 UTC.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic