You are here: irt.org | FAQ | JavaScript | Date | Q919 [ previous next ]
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>