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

Java date/time long value in database  RSS feed

 
Martin Coetzee
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone. Here's my question. We store the java date/time long value in the database as ie: 1173691253612. Another system that's non java needs to read the value, and interpret it as a date. How do you format this value into a date if you don't use java? Is there a special algorithm?
 
Jeremy Botha
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Martin.

The sun API documentation for date states that the long value of Date specifies the number of milliseconds since 01 January 1970, 00:00:00.000 GMT.

You need to ensure that the non-java system you're interfacing with either uses this epoch, or is able to do the conversion between the Java epoch and whatever epoch it operates in.

hope this helps!

Jeremy
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!