January 21, 2011 at 8:40 am
I am new at learning DATEPART and wanted to know how to write a DATEPART equate that shows 6 hours ahead of the time display. I am not sure if I need a CASE statement to make it work.
This is the basic idea: I have the ActivityDteTime showing in the report as:
2010-12-16 14:05:21.000
Instead of the time showing 2 pm CST - I need it to show 6 hours ahead of time as 8am
This is what I have so far, but I know does not work:
DATEPART(hh,c.ActivityDteTime + '06:00:00.000')
Any ideas?
January 21, 2011 at 8:54 am
would it not be better to use DATEADD to add 6hrs rather than DATEPART ?
January 21, 2011 at 8:58 am
I am not sure if it is the best way, but it seemed to work when I did this:
ActivityDteTime + '06:00:00.000' AS 'Start Time of Call'
What do you think?
January 25, 2011 at 3:30 am
If your ActivityDteTime is a varchar then that should work, otherwise if it is a datetime then you will need to use DATEADD
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply