Question

I have a unix timestamp from yesterday ('1384335000 ' = 11-13-2013) that I have saved in the database. I want to format that string into a mm-dd-yyyy format but cannot seem to get this just right.

The output of what I am getting back is: 13.11.2013. Even if I use strftime and format the stamp, it will never show as I want it to.

Here is my code:

datetime( e.start, 'unixepoch', 'localtime' ) AS testdate

Can someone please tell me what I am doing wrong here?

EDIT: I've tried using strftime again and I get 13.10.1910 back from this:

strftime('%m-%d-%Y', e.start, 'unixepoch', 'localtime') AS testdate
Was it helpful?

Solution

The unix timestamp is the number of seconds since Jan 1, 1970 UTC time. Create a reference date and add the seconds to it.

Unix timestamp wiki

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top