July 17, 2000 01:31 PM

Solving the Datetime Mystery

Rating: (0)
SQL Server Magazine
InstantDoc ID #9147
Surprising information about how SQL Server handles the datetime data type
One of the most interesting and confusing data types that SQL Server supports is datetime. I see more questions in online public discussion forums about this type than any other. I thought that I knew almost everything worth knowing about datetime data, and I've answered many questions in the discussion forums. But during the past several weeks, I've discovered that some things I thought were true about datetime aren't true at all. In this article, I shed light on some very confusing issues regarding this misunderstood data type.

Fir...

...This article is for paid Professional Members only.

Already a Professional Member? Please log in now:

NOT A PROFESSIONAL MEMBER? YOU CHOOSE:

Professional Membership

Monthly

Annual

VIP Membership

Monthly

Annual

Add a Comment

Wonderful article with lots of useful information. This is what I am looking for, deep inside information about SQL Server internals.

Thanks a lot.

Marcos3/11/2009 8:51:48 AM


Waste, need to explain more

Anonymous User 5/24/2005 3:27:49 PM


I ran the stored procedure on the database! problem solved! But regional settings should be determined by local OS, for db-servers and clients. So date-time formats/conversions shouldn't be an issue. In java its possible to make a very thin country/location-specific layer on the Locale class. Very handy and the solution is only on one place/not scattered through the software

Greetz,
Peter

Anonymous User 3/15/2005 6:43:40 AM


Just where did you come up with the name "Sue" for a user?

Anonymous User 11/22/2004 1:39:42 AM


Very useful. I solved a very hard problem. Thank you so much..

Murat Yýldýz 6/28/2004 3:42:53 AM


I just speak a little bit of english so i'm going to try explain.This article it was really helpful for me, and i have a problem with convert(datetime,@date) so if you can helpme i'll be grateful, thanks

Gaabriela 3/24/2004 8:23:43 AM


how can we get only time not both date and time

praveen5/12/2001 12:15:46 AM


Hi Kalen,

your article was the first thing I read from the sep. SQLMag. We experienced almost all the problems you noted. But one thing still gives us a lot of trouble. The check for the same day. (Elimination of the time part). Right now we attack this problem with statements like this:
select
convert (datetime, floor(convert (float, date_col)), 121)
from table.

which makes use of the internal structure. Can I rely on this or is there some better way to satisfy upcoming releases of SQL-Server.

Kind regards

Thomas

Thomas Böhm 9/29/2000 2:08:38 AM


You must log on before posting a comment.

Are you a new visitor? Register Here
GOOGLE LINKS
SPONSORED LINKS
FEATURED LINKS