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

Set Time Method


The Set Time method sets dateVar to a date that Siebel CRM determines from the value you specify in the milliseconds argument, calculated from January 1, 1970, GMT. To set a date earlier than this date, you can use a negative number.

Format

dateVar.setTime(milliseconds)

For more information about the milliseconds argument, see Values for Dates and Times.

Example

The following example uses 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);
}

For example, if you enter a value of -345650, then this code provides the following result:

The specified date is 12/31/1969 at 3 P.M.

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