get current timestamp code example

Example 1: return current date in javascript

let today = new Date().toLocaleDateString()

console.log(today)

Example 2: get current timestamp shell

// If you want to get unix timestamp, then you need to use:
timestamp=$(date +%s)

Example 3: how to get timestamp in javascript of a date object

new Date().getTime()

new Date().valueOf()

Example 4: javascript get timestamp

var currentTimeInSeconds=Math.floor(Date.now()/1000); //unix timestamp in seconds
var currentTimeInMilliseconds=Date.now(); // unix timestamp in milliseconds

Example 5: how to get the timestamp in javascript

const currentTimeInMilliseconds=Date.now(); // unix timestamp in milliseconds

Example 6: convert int to timestanp js

Date.now()

and

new Date(1381216317325);

Tags:

Sql Example