Please start any new threads on our new site at http://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Site Related Forums
 Article Discussion
 Article: Best Practices for Date/Time Calculations
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

snSQL
Flowing Fount of Yak Knowledge

USA
1837 Posts

Posted - 05/30/2007 :  10:54:34  Show Profile  Reply with Quote
http://www.devx.com/dbzone/Article/34594/

Comments?

graz
Chief SQLTeam Crack Dealer

USA
4149 Posts

Posted - 05/30/2007 :  11:02:30  Show Profile  Visit graz's Homepage  Reply with Quote
My first comment is that this particular forum is for discussion of articles on this site :) Can you move your post to one of the other forums? Maybe the T-SQL forum? Thanks!

-graz

===============================================
Creating tomorrow's legacy systems today.
One crisis at a time.
Go to Top of Page

spirit1
Cybernetic Yak Master

Slovenia
11752 Posts

Posted - 05/30/2007 :  11:02:34  Show Profile  Visit spirit1's Homepage  Reply with Quote
nice!
is it yours?

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

rockmoose
SQL Natt Alfen

Sweden
3279 Posts

Posted - 05/30/2007 :  13:11:13  Show Profile  Reply with Quote
It's a good article. Deeper discussion on datetime type, and why the inbuilt functions should be used.
Maybe misses a point that the inbuilt functions are there for a purpose,
and that they will work even if the internal representation of datetime is changed.

rockmoose
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

USA
7020 Posts

Posted - 05/30/2007 :  14:56:07  Show Profile  Reply with Quote
There are a lot of SQL Server date manipulations I see that make me cringe.

For example, this code to get today a midnight.
select convert(datetime,floor(convert(float,getdate())))


or this code to get the time without the date:
select convert(datetime,convert(varbinary(4),getdate()))


CODO ERGO SUM

Edited by - Michael Valentine Jones on 05/30/2007 14:56:46
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000