Wednesday 13 November 2019

Calculating Difference Between two dates in Siebel eScript - Part 2

Hello All,

I my previous post we calculated difference between 2 Dates i.e. Sysdate and Other date that was stored in Database in Date format.

Recently i had to compare a date stored as varchar in database with sysdate.

Var storedDate = '30-11-1990' ;

I had to compare if the var storedDate is greater then current date or not, its very easy we just need to make the variable a date object.

Note: The format of string to be passed should be DD/MM/YYYY
var storedDate = '01/11/2019';
var dd2 = storedDate.substring(0,2);
var mm2 = storedDate.substring(3,5);
var yy2 = storedDate.substring(6,10);
var formatedStoredDate= dd2 + "/" + mm2 + "/" + yy2;

now we have date in DD/MM/YYYY format, lets convert this to date Object

var nDate = new Date (formatedStoredDate);

to compare this date with current date ,

var currDate = new Date ()

if (nDate > currDate )
// Stored date is Greater
//stored date is smaller

No comments:

Post a Comment

Siebel GoTo View - Handling Realtime cases

 Hello All,  We all must have used GoTo view functionality of siebel to navigate to a particular view from current view. What if the require...