Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Saving date and time and getting date
Message
 
To
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:
01451716
Views:
31
>>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.

:-)))
.937 is just a random number :-) I just want to show you that there is millisecond value that is stored in DateTime field.
I'll try to zoom the picture, but not now :-)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Reply
Map
View

Click here to load this message in the networking platform