Clib.difftime() Method
Syntax
Clib.difftime(timeInt1, timeInt0)
Parameter Description
timeInt0– An integer time value as returned by the Clib.time() function
timeInt1– An integer time value as returned by the Clib.time() function
Returns
The difference in seconds between timeInt0 and timeInt1.
Example
This example displays the difference in time, in seconds, between two times:
function difftime_Click ()
{
var first = Clib.time();
var second = Clib.time();
TheApplication().RaiseErrorText("Elapsed time is " +
Clib.difftime(second, first) + " seconds.");
}
But often time values are retrieved from the a date column in Siebel database. The value retrieved from cant be used directly and needs some manipulation to fit the format. Below is the snippet of the code used to retrieve date/time from the database and find the difference.
//Get Date value from field
var sDate = oBC.GetFieldValue("Opened Date");
//Assign it to Date Object
var sDate1 = new Date(sDate);
//Convert date object to integer equivalent
var sDate2 = sDate1.toSystem();
//find time difference between current time and date opened in seconds
var sTimeDiff = Clib.difftime(Clib.time(), sDate2);
No comments:
Post a Comment