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

Convert Date and Time to String Method


The Convert Date and Time to String method returns a string that includes the date and time of a date object according to the time zone of the computer that runs the script. It returns this date in the following format:

Day Mon dd hh:mm:ss yyyy

If you use this code in Siebel eScript, then the code runs on the Siebel Server. The Siebel Server might or might not reside in the same time zone where the user resides. If you use this code in JavaScript, then the code runs on the user computer and uses the time zone of the user computer.

Format

dateVar.toLocaleString()
dateVar.toString()

Example

The following example displays the local time from the computer clock, the UTC time, and the Greenwich mean time (GMT):

var aDate = new Date();
var local = aDate.toLocaleString();
var universal = aDate.toUTCString();
var greenwich = aDate.toGMTString();
TheApplication().RaiseErrorText("Local date is " + local +
   "\nUTC date is " + universal +
   "\nGMT date is " + greenwich);

This example provides the following results:

Local date is Fri Aug 12 15:45:52 2005
UTC date is Fri Aug 12 23:45:52 2005 GMT
GMT date is Fri Aug 12 23:45:52 2005 GMT

Related Topics

For more information, see the following topics:

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