Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q919 How do I convert a date in milliseconds back to a date string?

irt.org | Knowledge Base | JavaScript | Date | Q919 [ previous next ]

Q919 How do I convert a date in milliseconds back to a date string?

Simply as:

<script language="JavaScript"><!--
var milliseconds = 937858019615;
var myDate = new Date(miliseconds);
//--></script>

The Date() constructor can be passed four different set of arguments:

<script language="JavaScript"><!--
var myDate = new Date(); // creates a date set to the current date and time
var milliseconds = 937858019615;
var myDate = new Date(milliseconds); // creates a date that represents the number of milliseconds after midnight GMT on Januray 1st 1970.
var myDate = new Date(datestring); // Date (and time) string in the format Sat, 13 Mar 1999 15:17:50 -0100
var myDate = new Date(year,month,day,hours,minutes,seconds,milliseconds); // where month is 0 to 11 for Jan to Dec
//--></script>

Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.