Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Time and Zone Subtraction

Status
Not open for further replies.

KOVMoe

Programmer
Jun 30, 2004
34
US
I have a time field, GMT, that I need to subtract the local time zone from. Example if I am in Dallas I need to subtract 6 hours, Standard, from the time stamp entered. I have the time and another field that has the number of hours behind or ahead. The time filed is datetime, the time zone factor is char(10), stored as -5.00. I have tried to cast or convert, but I know I cannot get the numebr I need.

Here is the code I am using.
SUM(CASE WHEN(DATEPART(HH,(DATEADD(HH,CAST(A.UTC_TCF_MT_QY AS REAL),A.PKG_DEL_TM)))= 09)AND(A.PKG_DEL_DT BETWEEN @dtPuDate1 AND @dtPuDate2)THEN 1 ELSE 0 END)AS PU09

Can anybody tell me what I am doing wrong. I should have a number in the high 1000's, but I get 0.

Thanx


Thank you,

[king]Moe-King of the Village Idiots.

"When in trouble,
when in doubt;
Run in circles-
SCREAM & SHOUT!!"
Burma Shave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top