Clib Convert Time Object to Integer Method
The Clib Convert Time Object to Integer method converts a time object to the time format that the Clib Convert Time to Integer method returns. It returns one of the following values:
If it can convert the value in the Time argument, then it returns the value that the Time argument contains expressed as an integer.
If it cannot convert the value in the Time argument, then it returns negative 1.
It sets any element of the Time argument that is not defined to 0 before it performs the conversion. This method is the opposite of the Convert Integer to Local Time method that converts a time integer to a time object.
Format
Clib.mktime(Time)
The following table describes the arguments for the Clib Convert Time Object to Integer method.
Argument | Description |
---|---|
Time |
A time object. |
Example
The following example uses the Clib Convert Time Object to Integer method to format a time so that Siebel eScript can use it with the Clib Get Difference in Seconds method:
// 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);
This example produces the following result:
COMMENT,Seconds since midnight: 59627
For an example that describes the difference between the formats that asctime and mktime use, see Clib Get Date and Time Method.
Related Topics
For more information, see the following topics: