How to convert a date/time parameter to unixtime


Hi everyone. I'm trying to create a form that retrieve values from a database. The database field has a date/time column that store values in unixtime format. The report created in jasper uses a calendar in witch we select Date and Time. I need a way to convert the values entered in the jasper calendar Date/Time to unixtime so i can build the sql query. The values entered in the calendar are convert to a weird format as can be seen in the pictures below.




rouchi.spam's picture
Joined: Dec 9 2013 - 7:41am
Last seen: 2 years 2 months ago

2 Answers:



The way to convert a date into unixtime stamp is

(Day difference from the date to 01/01/1970) x 86400 = UnixTime


Rajesh S


rajesh.sirsikar's picture
Joined: Apr 21 2014 - 5:43am
Last seen: 1 year 6 months ago

There's an SQL function for this.  FROM_UNIXTIME()  will take a Unix timestamp and make it a Java compatible date.

djohnson53's picture
Joined: May 25 2012 - 11:10am
Last seen: 1 hour 37 min ago