Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

HI, i need to calculate no of days and hour

hi from the Startdate to Enddate i need calculate the no of  days and hours,

so i have enter the expression as ,

Interval(Startdate-Enddate,'d hh:mm')

but it is not returning the value kindly clarify me.,

4 Replies
arvind_patil
Partner - Specialist III
Partner - Specialist III

Hi Lakshminarayanan,

Please  try below one:

Load

..

num(Startdate)-Num(EndDate) as NOofDays,

..

From

<path...>


Thanks,

Arvind Patil

Anonymous
Not applicable
Author

hi need to calculate the hours also ,kindly help me out

Anonymous
Not applicable
Author

Hi Lakshminarayanan


I hope this works.

Please check below code:


set a=26/04/2017;

set b=27/05/2017 10:05:00;

let c=Interval(Date(b,'DD/MM/YYYY hh:mm:ss')-Date(a,'DD/MM/YYYY hh:mm:ss'),'DD hh:mm:ss')

Thanks

Sristi

jonathandienst
Partner - Champion III
Partner - Champion III

Are both Startdate and Enddate in  numerical date format, or as strings? For a quick check, create a list box for each field and check the alignment - if left aligned they are string values and you need to convert them to dates (preferably when you load them).

Something like

LOAD ....

    Date(Date#(Startdate, 'yyyy/MM/dd hh:mm')) as Startdate,

    Date(Date#(Enddate, 'yyyy/MM/dd hh:mm')) as Enddate,

    ...

(change the fomat string to match the format of the string values)


Then the syntax you used should work.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein