Siebel eScript Language Reference > Siebel eScript Commands > Date and Time Methods >
setTime() Method
This method sets a Date object to a date and time specified by the number of milliseconds before or after January 1, 1970. Syntax
dateVar.setTime(milliseconds)
|
|
milliseconds |
The number of milliseconds from midnight on January 1, 1970, GMT |
Usage
This method sets dateVar to a date that is milliseconds milliseconds from January 1, 1970, GMT. To set a date earlier than that date, use a negative number. Example
This example accepts a number of milliseconds as input and converts it to a date and hour. function dateBtn_Click () { var aDate = new Date; var milli = -4000; aDate.setTime(milli); var aYear = aDate.getFullYear(); var aMonth = aDate.getMonth() + 1; var aDay = aDate.getDate(); var anHour = aDate.getHours();
switch(anHour) { case 0: anHour = " 12 midnight."; break; case 12: anHour = " 12 noon."; break; default: if ( anHour > 11 ) anHour = (anHour - 12) + " P.M."; else anHour = anHour + " A.M."; }
TheApplication().RaiseErrorText("The specified date is " + aMonth + "/" + aDay + "/" + aYear + " at " + anHour); }
Example, if you enter a value of -345650, the result is: The specified date is 12/31/1969 at 3 P.M.
See Also
getTime() Method
|