toharikr
asked on
siebel escript to compare two dates
My Requirement is to write a escript to compare the dates.whiich I am getting from the following sources
1st Date : order date from order BC in MM/DD/YYYY format
2nd date : 14 days before date from current date.. DD/MM/YYYY
After capturing the aboce two dates i need to write a escript in siebel to compare the dates to find which date is larger..
I have tried a sample code ..for the 2nd date mentioned above.
var DateObject = new Date();
var DateObject1 = new Date(DateObject - 1209600000);
var datebefore=DateObject1.get Month()+"/ "+DateObje ct1.getDat e() +"/"+DateObject1.getFullYe ar()+" "+DateObject1.getHours()+" :"+DateObj ect1.getMi nutes()+": "+DateObje ct1.getSec onds();
Can anybody correct me or share the code for the aboce requirement.
Thanks a lot.
1st Date : order date from order BC in MM/DD/YYYY format
2nd date : 14 days before date from current date.. DD/MM/YYYY
After capturing the aboce two dates i need to write a escript in siebel to compare the dates to find which date is larger..
I have tried a sample code ..for the 2nd date mentioned above.
var DateObject = new Date();
var DateObject1 = new Date(DateObject - 1209600000);
var datebefore=DateObject1.get
Can anybody correct me or share the code for the aboce requirement.
Thanks a lot.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The only caveat is that since this is done using eScript (server script), it will use the date and time on the server, which may not be the same as the date and time that your order buscomp is returning. The Order Date on the Order Entry - Orders business component returns a date and time in the time zone of the currently logged in user.
If you use a date object to compare the dates instead of a date string, you would get the number of milliseconds since the epoch using the date.getTime method (dt.getTime ()), instead of the date.parse method (Date.parse (sDate2)).
Hope this helps,
Mike
Open in new window