GIT – Get Unix timestamp in Java, Python, Erlang value in seconds

java:

long timestamp = System.currentTimeMillis()/1000

Python:

import time
timestamp = int(time.time())

Erlang:

{Mega, Secs, _} = now(),
Timestamp = Mega*1000000 + Secs,

Working with timestamps in MySQL

mysql> SELECT UNIX_TIMESTAMP('1997-10-04 22:23:00');
-> 875996580
mysql> SELECT FROM_UNIXTIME(1111885200);
+---------------------------+
| FROM_UNIXTIME(1111885200) |
+---------------------------+
| 2005-03-27 03:00:00 |
+---------------------------+

Print Friendly

Comments

comments

Bài viết liên quan