You are here: Re: how to truncate a MySQL date « PHP SQL « IT news, forums, messages
Re: how to truncate a MySQL date

Posted by NC on 03/11/06 20:41

laredotornado@zipmail.com wrote:
>
> I have a MySQL column that's of a DATETIME type. What MySQL function
> can I apply to it in a SELECT statement to make the time midnight? FOr
> example, if a value of the column was
>
> 2006-03-07 21:00:00
>
> I'd like to apply a MySQL function and make the value
>
> 2006-03-07 00:00:00

This should work:

UPDATE mytable
SET myDTcolumn = DATE_FORMAT(myDTcolumn, '%Y-%m-%d 00:00:00');

Cheers,
NC

 

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

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