0

I am getting a variable with Gregorian seconds and would like to use it in Java. Is there a library function in Java <=8, JodaTime, Apache commons, guava or anything else, where this is implemented?

I know I can convert the gregorian seconds to epoch timestamp by multiplying by 1000 and then subtracting 62167219200000 but I'd prefer not to hardcode it if there already is an implementation. I haven't found any so far.

[edit: this is not a duplicate of the linked question, there's no xml dateTime used here, the answer in linked question does not answer this one]

Wolf
  • 871
  • 1
  • 7
  • 21
  • You dont have to multiply by 1000, just subtract 62167219200 its a simple subtraction, so adding a library for that seems overhead... – user1933888 Dec 18 '15 at 23:39
  • we already have a huge amount of libraries added anyway so if there is an implementation in one of the common libraries, I wouldn't have to add anything – Wolf Dec 18 '15 at 23:51
  • http://stackoverflow.com/a/4018528/1123020 – Yoda Dec 19 '15 at 00:02

0 Answers0