Jim Horn
asked on
Data formatting: GETDATE() - 1 day, with time 00:00:00.000
I need a function build that returns whatever yesterday was, with the timestamp of 00:00:00.000
i.e. Set @variable = CONVERT(datetime, getdate(), 101), with time 00:00:00.000 instead of 15:25:55:042
TIA
Jim
i.e. Set @variable = CONVERT(datetime, getdate(), 101), with time 00:00:00.000 instead of 15:25:55:042
TIA
Jim
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
>select cast(convert(varchar(10), dateadd(d, -1, getdate()), 101) as datetime)
Worked.
>http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=64759
This could come in handy.
>CONVERT(datetime, month(getdate()) + day(getdate()) + year(getdate()), 101)
returned 1905-07-27 00:00:00.000
Worked.
>http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=64759
This could come in handy.
>CONVERT(datetime, month(getdate()) + day(getdate()) + year(getdate()), 101)
returned 1905-07-27 00:00:00.000
doh sorry
i think this might work