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):





February 6th, 2009 at 7:01 am
Hi Sridhar,
This is a nice Article. It is very useful.
By,
Mohana.
February 6th, 2009 at 7:16 pm
I am glad you liked it.
Regards,
Sridhar
March 17th, 2009 at 8:27 am
Pls provide the same with Actuate Reports
June 1st, 2009 at 1:23 pm
Hi,
just found this site from google by finding some hints about time & dates in eScript so this article helps perfectly. I hope there will be time to go through the whole site and learn something useful.
Thanks, best regards.
June 16th, 2009 at 12:19 pm
hi could you please tell me is ther any way to send the email in the HTML format we tried the option as changing the default message type in the
userprefrences –>the Outbound COmmunications
Under Send Email
Select Default Message Format: HTML
Click the Save button
but no luck.
June 18th, 2009 at 5:23 pm
after you do the change under userpreferences did u clear cache and logout and login? also how are you creating the email? I tested using F9 and it works great. make sure the template you use is actually HTML template.
this should work. good luck.
I appreciate your participation but please use Forum available in this website to post questions. Thanks.
July 2nd, 2010 at 7:05 am
Hi Sridhar,
It would have been nice to just a little extended of showing to data fields from BC and showing the function of time difference between those two date variables. Even now its pretty simple of doing by the example as the reference. I meant a more complete example for two data fields. That is all.
But highly appreciated your effort of getting the people learn siebel and its tricks.
Wishing you all the best for further postings and blogs
Regards,
Srini
July 2nd, 2010 at 7:05 am
Sorry its two date variables
July 6th, 2010 at 4:55 am
Hi Srini,
I will work on it and will post something soon. Thanks.
August 13th, 2010 at 9:15 am
Hi,
Can u pls tell me how to get the difference between two date fields by ignoring weekends (i.e satday, sunday if exists within the difference)
Thanks in Advance.
Regards,
Ramya
August 18th, 2010 at 6:35 am
hi
ramya
this is vardhan i am in obiee developer
i am not undrstanding ur query
can u repeat once again with ex;
Thank u