JavaScript Get Timestamp

JavaScript Get Timestamp: You can use to get the UTC Timestamp in milliseconds. Works for all major browsers. Here in this tutorial we are going to explain how to get current timestamp in javaScript. We will also learn how to use the timestamp in javaScript.

JavaScript Get Timestamp

Here is simple example which will give you timestamp in javascript-

JavaScript Get Timestamp:

<script type="text/javascript">
document.write("Current Date = "+Date()+"<br>");
document.write("Current TimeStamp = ";

Try it »

In the above example we have shown how to get current date and timestamp in javascript. The UTC timestamp shown above will work in all modern browsers.

Note :For older browsers use Date().getTime() instead of using

The output of the above example will look something like this –

JavaScript Get Timestamp

More About JavaScript Timestamp

Let’s have look over the JavaScript time & Date with more example and demo here.

Convert UTC date time to local date time in JavaScript

You can convert the UTC time to local date time as below-

Convert UTC date time to local date time in JavaScript:

<script type="text/javascript">
function localizeTime(currTime)
  var dt=new Date(currTime+" UTC");
  document.write("After Conversion = "+dt.toString());
<script type="text/javascript">
 document.write("Time Before Conversion = "+Date()+"<br>");

Try it »

The above example will give you the converted time local time from the UTC. When you run the above demo it will produce the output like this-

JavaScript Get Timestamp


Add Comment

📖 Read More