CR10,sql db
There are two tables orders and city. One of the joins is orderCitycode = CityCityCode
I have a datetime field stp_arrivaldate that I perform a calculation on using the currentdatetime that the report is run to determine if a delivery is running late or not.
at the moment I am not taking time zones into consideration if report is run at 10:45 eastern
Line one is correct, line two is not
We did not have the ability to use field cty_GMTDelta until now it was always null. Without that field, the following is the code I am currently using to determine HowLate
Cty_GMTDelta
5.00 = eastern
6.00 = central
7.00 = mountain
etc.
I was thinking of using an if/else statement that checks for the cty_GMTDelta then changes the above calculation in some way. If the field is 5.00 no change is needed. If it is 6.00 I need the CurrentDatetime + 1 hour. Would that be CurrentDateTime + 3600?
If there is an easier way to do this, I am all ears
Thanks again
Julie
CR 9,10 CE10 Sql DB
There are two tables orders and city. One of the joins is orderCitycode = CityCityCode
I have a datetime field stp_arrivaldate that I perform a calculation on using the currentdatetime that the report is run to determine if a delivery is running late or not.
at the moment I am not taking time zones into consideration if report is run at 10:45 eastern
Code:
OrderNum stp_arrivaldate HowLate CallforExcuse cty_GMTDelta
1234 02/07/06 7:00 0d:3h:45m 123-4567 5.00
4567 02/07/06 10:00 0d:0h:45m 123-4569 8.00
We did not have the ability to use field cty_GMTDelta until now it was always null. Without that field, the following is the code I am currently using to determine HowLate
Code:
numbervar tsecs := datediff("s",{Rpt_LateLoadsScheduled;1.stp_arrivaldate},currentdatetime);
numbervar ndays := truncate(tsecs/86400);
tsecs := remainder(tsecs,86400);
numbervar nhours := truncate(tsecs/3600);
tsecs := remainder(tsecs,3600);
numbervar nmin := truncate(tsecs/60);
tsecs := remainder(tsecs,60);
if nhours-24<=0 then totext(ndays,0)+"D: "+totext(nhours,0)+"H: "+ totext(nmin,0)+
"M: "
Cty_GMTDelta
5.00 = eastern
6.00 = central
7.00 = mountain
etc.
I was thinking of using an if/else statement that checks for the cty_GMTDelta then changes the above calculation in some way. If the field is 5.00 no change is needed. If it is 6.00 I need the CurrentDatetime + 1 hour. Would that be CurrentDateTime + 3600?
If there is an easier way to do this, I am all ears
Thanks again
Julie
CR 9,10 CE10 Sql DB