You are here: Re: MySql question - can I add 90 minutes to an INT field « PHP Programming Language « IT news, forums, messages
Re: MySql question - can I add 90 minutes to an INT field

Posted by Chris Hope on 05/11/05 11:34

lkrubner@geocities.com wrote:

> All the timestamps in my code are wrong by 90 minutes.
>
> date INT(11),
>
> I'd like to add 5400 to every date field in my database. Rather than
> do this in PHP, I'm wondering if MySql has a command that would allow
> me to do this directly.

This ought to do it:

update tablename set fieldname = fieldname + 5400

If you've named your field "date" you'll need to enclose the fieldname
with backticks as date is a reserved word in MySQL ie

update tablename set `date` = `date` + 5400

Actually I could be wrong about having to have backticks. I know there's
an exception for at least one reserved word (which is probably "date")
which works without the backticks because it was so commonly used as a
fieldname and they didn't want to break compatibility, or something
along those lines.

--
Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com

 

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

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