You are here: Re: WHAT DO I USE TO MAKE A TODAY DATE QUERY? « MsSQL Server « IT news, forums, messages
Re: WHAT DO I USE TO MAKE A TODAY DATE QUERY?

Posted by Ross Presser on 07/22/05 00:14

On Thu, 21 Jul 2005 18:07:49 +0000 (UTC), Erland Sommarskog wrote:

> Anyway, the best way to strip out the time component is:
>
> convert(char(8), getdate(), 112)

that leaves you with a char value. I prefer

convert(datetime, floor(convert(float,getdate())))

even though it's a bit wordier, because it can't possibly be sensitive to
the region, and also because it has useful variants. Like this, which
rounds a time down to the start of the hour:

convert(datetime, floor(convert(float,getdate()) * 24) / 24)

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация