Converting Integer time stamp into java date

datetime, java

Solution

Assuming its the time since 1/1/1970 in seconds. you can try

String dateAsText = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
                          .format(new Date(1333125342 * 1000L));

Problem

I have following time stamp in Integer form ``` 1333125342 ``` I can convert it using SQL: ``` select DATEADD(ss, FlOOR(1333089223/86400)*86400, '1970-01-01 00:00:00') AS Date ``` How to convert it in java? So that it would return value: ``` 3/30/12 12:18:43 PM ```

Original source

Related problems