Set UTC Milliseconds Method
The Set UTC Milliseconds method sets the UTC millisecond of a date object to a date expressed in milliseconds relative to the UTC equivalent of the system time. The value of dateVar becomes equivalent to the number of milliseconds from the UTC equivalent of the time on the system clock. You can use a positive number for later times or a negative number for earlier times.
Format
dateVar.setUTCMilliseconds(millisecond)
The following table describes the arguments for the Set UTC Milliseconds method.
Argument | Description |
---|---|
millisecond |
The UTC millisecond to set in dateVar as a positive or negative integer. For more information, see Values for Dates and Times. |
Example
The following example gets a number of milliseconds as input and converts it to a UTC date and time:
function dateBtn_Click ()
{
var aDate = new Date;
var milli = 20000;
aDate.setUTCMilliseconds(milli);
var aYear = aDate.getUTCFullYear();
var aMonth = aDate.getMonth() + 1;
var aDay = aDate.getUTCDate();
var anHour = aDate.getUTCHours();
var aMinute = aDate.getUTCMinutes();
TheApplication().RaiseErrorText("The specified date is " +
aMonth +
"/" + aDay + "/" + aYear + " at " + anHour + ":" +
aMinute + ", UTC time.");
}
If run at 5:36 P.M., PST (Pacific Standard Time), on August 22, 2005, then this example produced the following result:
The specified date is 8/23/2005 at 1:36 UTC time.