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

toLocaleString() Method and toString() Method


These methods return a string representing the date and time of a Date object based on the time zone of the computer running the script.

Syntax

dateVar.toLocaleString()
dateVar.toString()

Returns

A string representing the date and time of dateVar based on the time zone of the computer running the script, in the form Day Mon dd hh:mm:ss yyyy.

Usage

These methods return a string representing the date and time of a Date object based on the local time zone of the computer running the script. If the code is implemented in eScript, then the code runs on a server. The server may or may not be in the same time zone as the user. If the code is implemented in JavaScript, then the code runs on the user's computer and uses that computer's time zone.

Example

This example displays the local time from the computer's clock, the Universal time (UTC), 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);

The result appears in a message box similar to the following:

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

See Also

Clib.asctime() Method
Clib.gmtime() Method
Clib.localtime() Method
toGMTString() Method
toUTCString() Method

Siebel eScript Language Reference