Siebel eScript Language Reference > Siebel eScript Commands > Date and Time Methods >

setMilliseconds() Method


This method sets the millisecond of a Date object to a date expressed in milliseconds relative to the system time.

Syntax

dateVar.setMilliseconds(millisecond)

Parameter
Description

millisecond

The millisecond to which dateVar should be set as a positive or negative integer

Returns

A date

Usage

This method sets the millisecond of dateVar to millisecond. The value of dateVar becomes equivalent to the number of milliseconds from the time on the system clock. Use a positive number for later times, a negative number for earlier times.

Example

This example accepts a number of milliseconds as input and converts it to the date relative to the date and time in the computer's clock.

function test2_Click ()
{
   var aDate = new Date;
   var milli = 7200000;
   aDate.setMilliseconds(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);
}

7200000 milliseconds is two hours, so if you run this routine on November 22, 2005 sometime between 3 and 4 P.M., you get the following result:

The specified date is 11/22/2005 at 5 P.M.

See Also

getMilliseconds() Method
setTime() Method
setUTCMilliseconds() Method

Siebel eScript Language Reference