Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What is Midnight of a NEW Day in SQLServer ?

Status
Not open for further replies.

ajacode

Technical User
Aug 21, 2002
66
US
IS the beginning of a new day in Date Time format in SQL server 2000:

A) 12:00:00 AM OR

B) 00:00:00 AM ?

C) Makes no Difference

I have heard that A is actually 12 Noon a nanosecond before the PM cycle since PM is actually 12:00:01

Thanks for the Reply
 
2003-12-03 23:59:59.999 end of today
2003-12-04 00:00:00.000 Start of tomorrow
 
12 AM is Noon.

Here's another way to look at it:

'regular time' 24hr time
00:00 0000
01:00 am 0100
06:00 am 0600
12:00 am 1200
01:00 pm 1300
06:00 pm 1800

etc....

-SQLBill
 
Sorry to disagree SQLBill, but 12:00 AM is Midnight. 12:00 PM is Noon.

If you set a datetime variable to a date with no time, it will use 00:00.00 as the default time.

Try this in Query Analyzer:

DECLARE @Time DateTime
SET @Time = '1/1/1'
PRINT @Time

The result is:
Jan 1 2001 12:00AM


Calen
 
ajacode,

To answer your question:

C). 12:00:00 AM is the same as 00:00:00 and SQL Server would be happy with either as an input.
 
Calen,

The things lack of sleep do to me. I can't type, I can't think. Oh well...thanks for correcting me.

-SQLBill
 
Thanks Everybody,

This subject as small as it is can generate a number of approaches.

I think you for your contributions all..

Happy HolidaysPS My 6 year old can now tell Santa what the proper time for him to arrive <grin>

AJACode
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top