Reputation: 187539
Is there a MySQL function that converts timestamps to a datetime
. I tried the following:
SELECT FROM_UNIXTIME(1337951145000);
But it returns null.
Upvotes: 2
Views: 2707
Reputation: 443
Your timestamp is valid ok.
Currently, timestamps are either 10 or 13 digits. 13-digit Timestamps (such as yours) have an additional 3-digit microseconds.
But to my (Google's) knowledge, MySQL's functions only supports the short 32bit timestamp (and you are not the only one to hit this wall.
Hopefully they'll sort it out before 2038.
Upvotes: 2
Reputation: 160863
The maximum representable time is 2038-01-19. At 03:14:07 UTC, you timestamp is over that.
Upvotes: 2
Reputation: 114188
Your timestamp is too long, try
SELECT FROM_UNIXTIME(1337951145);
Or
SELECT FROM_UNIXTIME(1337951145.000);
Upvotes: 2