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

Set Milliseconds Method


The Set Milliseconds method sets the millisecond of a date object to a date expressed in milliseconds relative to the system time. The value of dateVar becomes equivalent to the number of milliseconds from the time on the system clock. You can use a positive number for a later time and a negative number for an earlier time.

Format

dateVar.setMilliseconds(millisecond)

Table 68 describes the arguments for the Set Milliseconds method.

Table 68. Arguments of the Set Milliseconds Method
Argument
Description

millisecond

For more information, see Values for Dates and Times.

Example

The following example accepts a number of milliseconds as input and converts it to the date relative to the date and time in the computer 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);
}

The number 7200000 milliseconds is two hours. If you run this code on November 22, 2005 between 3 P.M. and 4 P.M., then it provides the following result:

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

Siebel eScript Language Reference Copyright © 2015, Oracle and/or its affiliates. All rights reserved. Legal Notices.