Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to convert Java Date into Unix Time?

 
ahmad mudassar
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
How can a java Date be converted into Unix Time, Is there any API function available for that?
Any help appreciated.
Thanks
 
Peter Chase
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As the API documentation says, Date.getTime() "returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this Date object.
". Hope this is what you wanted.
Might I suggest, though, that a question that can be answered simply by reading the API is not really for the advanced forum?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic