Generate Timestamps
Generate UNIX timestamps
JavaScript:
var timestamp = Math.floor(Date.now()/1000);
//var timestamp = Math.floor((new Date).getTime()/1000);
Java:
long timestamp = System.currentTimeMillis()/1000;
Python:
timestamp = int(time.time())
Ruby:
timestamp = Time.now.to_i
Erlang:
{Mega, Secs, _} = now(),
Timestamp = Mega * 1000000 + Secs,
PHP:
<?php
$timestamp = time();
?>
MySQL:
SELECT FROM_UNIXTIME(1423946047);