Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
jmersing
Yak Posting Veteran
57 Posts |
Posted - 2010-12-02 : 08:08:42
|
| I have to change my end time field because the data Im working with is in GMT. The time subtracts properly, but the date sometimes jumps to the following day because of the time difference.Is there some method I can apply to subtract 6 hours from the end date?End TimeMin(convert(varchar,shiftassignment.endtime-DateAdd(Hour,6,108),108)) As EndTimeEnd Date(convert(varchar,shiftassignment.endtime,110)) As EndDateThanks |
|
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2010-12-02 : 08:17:50
|
| Not sure what the issue is.EndTime = convert(varchar(6),dateadd(hh,-6,shiftassignment.endtime),108) EndDate = convert(varchar(10),dateadd(hh,-6,shiftassignment.endtime),110) oops - think you are trying to subtract.==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
jmersing
Yak Posting Veteran
57 Posts |
Posted - 2010-12-02 : 09:07:39
|
| That seems to work other than the time format coming out a little strange 16:30:the last 2 zeros are not appearing. |
 |
|
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2010-12-02 : 09:12:49
|
| Change to varchar(8)==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
jmersing
Yak Posting Veteran
57 Posts |
Posted - 2010-12-02 : 09:14:48
|
| Nevermind, I get it I just expanded the varchar to (8) Thanks I really appreciate it!! |
 |
|
|
|
|
|
|
|