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

javascript - Iterate over array and calculate average values of array-parts -

iphone - Using nested NSDictionary with Picker -

objective c - Newbie question -multiple parameters -