Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Experts,
In my script, I have created a field
Interval(num(Date1)-num(Date2),'ss') as Difference
which gives me the difference between the two dates in seconds.
Using the same field I am writing an Expression:
=Sum(Difference)/3600
which converts the sum of difference in dates to hrs.
But what I am getting is Num(Sum(Difference))/3600 which is not required.
How to solve this issue.
hic please see if you can help me on this.
Regards,
Anjali Gupta
tresesco wrote:
Interval() formats the timestamp and doesn't change the underlaying value. Try like:
(Date1-Date2)*3600 as Difference
That should be
(Date1 - Date2) * 24 * 60 * 60
or
(Date1 - Date2) * 86400
Hi,
Can you provide some small app to demonstrate this issue so it is easy to look out.
Regards,
Anand
Interval() formats the timestamp and doesn't change the underlaying value. Try like:
(Date1-Date2)*3600 as Difference
How can you sum the dates??
What is the logic by suming the data and converting it into number and then divide by 3600?? It would not give you right data![]()
First convert your date/Time into hours and then divide it by 3600...
Why you are dividing by 3600??
Hi,
If you want difference in hours
then directly you can write
interval(date1-date2,'hh')
or
try expression suggested by tresesco
Regards
Balraj I want the difference in seconds so subtracting, and interval gives me the correct thing .
And i am diving it by 3600 to convert its summation into hrs.
Hi,
Getting the interval(date1-date2,'hh') gives the difference in hours.
Suppose the difference between the two is in muinutes then it will return 0. and summation of 0 won't give me the correct required answer.
Ok, got it. My mistake didnot notice 'ss' in your expression
.
Try tresesco suggestion.
tresesco wrote:
Interval() formats the timestamp and doesn't change the underlaying value. Try like:
(Date1-Date2)*3600 as Difference
That should be
(Date1 - Date2) * 24 * 60 * 60
or
(Date1 - Date2) * 86400
Sometimes it happens !
; being stupid can't be avoided ! But, fortunately there is always someone like you to spot and correct it.