hi,
for ex, if i enter some date from that date till today how many days? how to count no of days
Discussion posts and replies are publicly visible
When you have two dates, you can just subtract them. Wrap it into a tointeger() and you are good to go.
KM
You could use something like below:
tointeger(today() - ri!date)
I find it helpful to create an Expression Rule in my environments that can do a null-safe "elapsed days" comparison between any 2 dates, in the manner required by your system (i.e. sometimes if the starting and ending date are the same, you'd want to return a value of "1" instead of "0", in other words doing an "end dates inclusive" value). For example the following:
/* RULE_CalculateElapsedDays */ /* Takes a Start and End date and calculates total elapsed (i.e. deployed) days, inclusively -- e.g. if the start and end date are the same day, the total elapsed days will be 1 instead of 0. */ if( or( a!isNullOrEmpty(ri!startDate), a!isNullOrEmpty(ri!endDate) ), tointeger(null()), tointeger(ri!endDate - ri!startDate) + 1 )
what if i give date along with time how to calculate that [date and time]
Answer to above query, hope this helps