Handling Date and Time functions is very puzzling in eScript. Lot of developers mess around with the code to reach the result.
In this post I will explain the simplest way to find the time difference between two different times in Seconds using Siebel eScript.
Clib.difftime is the method used to calculate the time difference between two times.
As per bookshelf the usage and example as per bookshelf.
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);
So use this sample code as reference in your eScript. Hope this helps. Leave a comment.
Related posts(Auto Generated):




