display timestamp in javascript code example Example 1: js timestamp var timestamp = new Date().getTime(); Example 2: js get current timestamp Date.now();