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

 All Forums
 Site Related Forums
 Article Discussion
 Article: Best Practices for Date/Time Calculations

Author  Topic 

snSQL
Master Smack Fu Yak Hacker

1837 Posts

Posted - 2007-05-30 : 10:54:34
http://www.devx.com/dbzone/Article/34594/

Comments?

graz
Chief SQLTeam Crack Dealer

4149 Posts

Posted - 2007-05-30 : 11:02:30
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

11752 Posts

Posted - 2007-05-30 : 11:02:34
nice!
is it yours?

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

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2007-05-30 : 13:11:13
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)

7020 Posts

Posted - 2007-05-30 : 14:56:07
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
Go to Top of Page
   

- Advertisement -