By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,718 Members | 1,383 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,718 IT Pros & Developers. It's quick & easy.

MySql question - can I add 90 minutes to an INT field

P: n/a

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.

Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
lk******@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
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.