Siebel eScript Language Reference > Siebel eScript Commands > The Clib Object Time Methods >

Clib.mktime() Method

This method converts a Time object to the time format returned by Clib.time().





A Time object


An integer representation of the value stored in Time, or -1 if Time cannot be converted or represented.


Undefined elements of Time are set to 0 before the conversion. This function is the inverse of Clib.localtime(), which converts from a time integer to a Time object. For details on the Time object, see The Time Object.


This example shows a use of Clib.mktime in order to format a time so that it can be used with Clib.difftime.

// create time object and set time to midnight:
var midnightObject = Clib.localtime(Clib.time());
midnightObject.tm_hour = 0;
midnightObject.tm_min = 0;
midnightObject.tm_sec = 0;

// use mktime to convert Time object to integer:
var midnight = Clib.mktime(midnightObject);

// difftime can now use this value:
var diff = Clib.difftime(Clib.time(), midnight);
TheApplication().Trace("Seconds since midnight: " + diff);

The script produces a trace output similar to this:

COMMENT,Seconds since midnight: 59627

See Clib.asctime() Method for an example that shows the difference between asctime() and mktime() formatting.

See Also

Clib.asctime() Method
Clib.div() Method and Clib.ldiv() Method
Clib.gmtime() Method
Clib.localtime() Method
getDate() Method
getTime() Method
getUTCDate() Method

Siebel eScript Language Reference