Bookshelf Home | Contents | Index | Search | PDF |
Siebel eScript Language Reference > Siebel eScript Commands > The Date Object >
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)
Returns
Not applicable
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. To get the result shown in the illustration, a value of -345650 was entered.
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);
}See Also
Bookshelf Home | Contents | Index | Search | PDF |
Siebel eScript Language Reference Published: 18 April 2003 |