Siebel eScript Language Reference > Siebel eScript Commands > Universal Time Methods >
setUTCFullYear() Method
This method sets the UTC year of a Date object to a specified four-digit year. Syntax
dateVar.setUTCFullYear(year[, month[, date]])
|
|
year |
The UTC year to which to set dateVar as a four-digit integer |
month |
The UTC month to which to set year as an integer from 0 to 11 |
date |
The UTC date of month to which to set dateVar as an integer from 1 to 31 |
Usage
This method sets the UTC year of dateVar to year. Optionally, it can set the UTC month of year to month, and the UTC date of month to date. The year must be expressed in four digits. Example
The following example uses the setUTCFullYear method to assign the date of the 2000 summer solstice and the setUTCHours method to assign its time to a Date object. Then it determines the local date and displays it. function dateBtn_Click () { var Mstring = " A.M., Standard Time."; var solstice2K = new Date; solstice2K.setUTCFullYear(2000, 5, 21); solstice2K.setUTCHours(01, 48); var localDate = solstice2K.toLocaleString(); var pos = localDate.indexOf("2000") var localDay = localDate.substring(0, pos - 10);
var localHr = solstice2K.getHours(); if (localHr > 11 ) { localHr = (localHr - 12 ); Mstring = " P.M., Standard Time."; } var localMin = solstice2K.getMinutes();
var msg = "In your location, the solstice is on " + localDay + ", at " + localHr + ":" + localMin + Mstring; TheApplication().RaiseErrorText(msg); }
A sample run of this code produced the following result: In your location, the solstice is on Tue Jun 20, at 6:48 P.M., Standard Time.
See Also
getUTCFullYear() Method setFullYear() Method setYear() Method Universal Time Methods
|