sql - Get DateTime with time as 23:59:59 -


i'm trying statement specifies datetime field between start , end of previous month.

to this, need specify first day of previous month has time of 00:00:00 , last day of previous month has time of 23:59:59.

this second condition giving me headache..

can me out?

cheers

mssql 2008

try:

select dateadd(ms, -3, '2011-07-20') 

this last 23:59:59 today.

why 3 milliseconds?, because microsoft sql server datetime columns have @ 3 millisecond resolution (something not going change). subtract 3 milliseconds


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -