RE: [PHP] A simple date question
| From: | John W. Holmes | Date: | Sun, 18 May 2003 18:13:15 +0000 |
| Subject: | RE: [PHP] A simple date question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-148106@lists.php.net to get a copy of this message | ||
> All I want to do is input our local time into the mysql database with
time
> taken from a Unix server which is 15 hrs behind our time. We are
keeping
> Japan time of GMT + 8 hrs.
>
> I looked at many codes in PHp and Mysql and a bit confused.
What format are you storing the time in? If it's a Unix timestamp in an
INT column, then use mktime() to add 15 hours to the time before you
insert it.
If you're storing it as a MySQL datetime format, then you can use
something like this while inserting or extracting..
INSERT INTO table (datetime_column) VALUES (NOW() + INTERVAL 15 HOUR)
Or
SELECT datetime_column + INTERVAL 15 HOUR, other, columns FROM table ...
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/