This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Date class related query  RSS feed

 
Vishal Hegde
Ranch Hand
Posts: 1078
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
Posts: 21090
85
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
Boost this thread!