Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I need to find the difference between two dates. For this i used this expression below
(
dayStart(timestamp(END)) - dayStart(timestamp(START)))
but how to include the Start and end date also while subtracting
For Example:
START Date: 24-Feb-2013 and END Date: 2-Mar-2013
If i used the above expression, Result is : 6
But i need the result as 7 (24,25,26,27,28,1,2)
Any idea?
Thanks,
S.Selvakuamr
Simply add 1 to the result. Or use DayStart for the start date and DayEnd for the end date and round the result: round(dayend(end)-daystart(start))
try
Interval() function
example--
Interval(EndDate - StartDate)
Updated code
=Num(date#('2-Mar-2013','D-MMM-YYYY'))+1 - num(date#('24-Feb-2013','D-MMM-YYYY'))
=Num(date#('End','D-MMM-YYYY'))+1 - num(date#('Start','D-MMM-YYYY'))
=date#('End','D-MMM-YYYY')+1 - date#('Start','D-MMM-YYYY')
iNTERVAL(date#('2-Mar-2013','D-MMM-YYYY') - date#('24-Feb-2013','D-MMM-YYYY'),'DD')
Make sure that you have interpreted the fields correctly using Date#() or TimeStamp#() - Not Date() and TimeStamp(). If you have done so, you can just subtract one date from another and the result will be number of days between the two.
Date#(END, 'DD-MMM-YYYY') - Date#(START, 'DD-MMM-YYYY') as Duration
HIC
Thanks HIC but how to include Start and End date...
Let me put this in way, count of days between Start and end date (Including start and end date)
Selva
Simply add 1 to the result. Or use DayStart for the start date and DayEnd for the end date and round the result: round(dayend(end)-daystart(start))
Thanks Gysbert.. "Dayend" does the trick..
Selva