Date.UTC() : UTC : Date JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Date » UTC »

 

Date.UTC()












Syntax








Date.UTC(year, month, day, hours, minutes, seconds, milliseconds)

































year A four digit representation of the year.
month The month represented as an integer where 0 represents January and 11 represents December.
day The day of the month represented as an integer from 1 to 31. Optional argument.
hours The hour represented as an integer where 0 represents 12 am (midnight) and 23 represents 11 pm. Optional argument.
minutes The minutes in the hour represented as an integer from 0 to 59. Optional argument.
seconds The seconds in the minute represented as an integer from 0 to 59. Optional argument.
milliseconds The milliseconds in the second represented as an integer from 0 to 999. Optional argument.




The UTC() method is provided to create dates in universal time (GMT).

An integer, representing the number of milliseconds between midnight January 1, 1970 (GMT) to the date and time specified, is returned from the method.

The integer can then be used to create a new Date object.












<html>
    <script language="JavaScript">
    <!--
    theDate = new Date(Date.UTC(2002,9,29,20,5,8,10));
    document.write(theDate.toUTCString());
    -->
    </script>
    </html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Date
» UTC