MySql question - can I add 90 minutes to an INT field
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.
Re: MySql question - can I add 90 minutes to an INT field
lkrubner@geocit ies.com wrote:
[color=blue]
> 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.[/color]
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.
Comment