Get Date from timestamp in Groovy -


As trivial it may seem that, I do not find a way to convert a Unix timestamp into a Groovy to date object can.

I should try with 1280512800 , which should be Fri, 30 July 2010 18:00:00 GMT

My first attempt was

  New Date (1280512800) / False, Guru becomes 15 January 20:41:52 CET 1970   

Then I have read That Java timestamps use milliseconds, so I should use the

  new date ((1280512800 * 1000)) / long duration is irrelevant in groove, in any case I // Thursday, January 08 03:09:05 C ET 1970   

What is the correct way to convert a timestamp to a date? What if I want to specify the time zone to work?

The problem is that he is going with integers, then creating multiplication is causing. .

Try:

  New date (1280512800 L * 1000)   

or

  New Date (((Long (1280512800)) * 1000)    

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -