Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Saving date and time and getting date
Message
From
01/03/2010 05:14:30
Metin Emre
Ozcom Bilgisayar Ltd.
Istanbul, Turkey
 
General information
Forum:
Microsoft SQL Server
Category:
Database design
Miscellaneous
Thread ID:
01450712
Message ID:
01451715
Views:
48
>I strongly recommend you to use Naomi's suggestion:
>
>select * from myTable where DateField >=@Today and DateField < @Tomorrow --- Se here is only less that, not less than or equal
>
>Because SQL Server keeps milliseconds also you may filter some records if you use this:
>
>select * 
>      from myTable
>where DateField >=@Today and DateField <= @TodayAtMidNight
>
>You may have this records:
>01/01/2010 23:59:59.937 and that record will be filtered.

I read and understand what Naomi said. I just wanted to cut short. Actually I used this way to get today:

xfirstdate=Datetime(Year(Date()),Month(Date()),Day(Date())+1,0,0,0)
xlastdate=Datetime(Year(Date()),Month(Date()),Day(Date())+1,0,0,0)-1

Boris, You are a bit wrong. It's not 937, 997: I read about 997 http://www.karaszi.com/SQLServer/info_datetime.asp :))
And a thing about your new photo. I cannot see your face at that photo. Maybe you have to zoom it.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform