Javascript date utc
Recently, when using highstock for statistical analysis, the time object in the json object requires the utc format, and the millisecond is used to implement the function of dragging the number axis. Here we sort out the functions for UTC conversion.
JavaScript Date. UTC () function
Date. UTC () -- returns the number of milliseconds (timestamp) between the date object and the World Standard Time (UTC) midnight, January 1, January 1, 1970)
UTC function syntax
Date. UTC (year, month, day );
Date. UTC (year, month, day, hours );
Date. UTC (year, month, day, hours, minutes );
Date. UTC (year, month, day, hours, minutes, seconds );
Date. UTC (year, month, day, hours, minutes, seconds, microseconds );
UTC function parameters
Year-the year of the date object, which is a four-digit year value.
An integer between month and 0-11, used as the month of the date object.
The integer between day-1-31 as the number of days of the date object.
An integer between hours-0 (midnight) and 23, used as the hour of the date object
Minutes-an integer between 0 and 59, used as the minute count of the date object
The integer between seconds-0-59, used as the number of seconds of the date object.
Microseconds-an integer between 0 and, expressed as the number of milliseconds of the date object.
UTC function return value
Returns the number of milliseconds (timestamp) between the date object and midnight on January 1, January 1, 1970)
UTC description
This function is a static function and should be called directly.
You can obtain a log from both the UTC method and the Date object constructor. The difference between them is that the UTC method is assumed to be UTC, And the Date object constructor is assumed to be local time.
UTC function example
Document. write (Date. UTC (2014, 01, 01 ));