|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
I have written a guest book .php3
and store the time of each message by using NOW(). My Webhosting server has a time different -13 hours to my location. I just wonder is there any method which can: 1) correct the time before the data write into MySQL DB, or 2) correct the time before it displayed in the browser. I am using following functions to write and retreive time INSERT INTO MyGuestBook (message,time) VALUES ('$message', NOW()); and $result = mysql_query_db ( ... ...); $row = mysql_fetch_object($result); echo $row->time; any expert here can provide a method to me for displaying the correct time? ps. i am using a web hosting server, i cannot modify the timezone in MySQL. |
|
#2
|
|||
|
|||
|
You can use the mysql adddate() function to add to the timestamp when you retrieve the data:
query="select message,adddate(time,"INTERVAL 13 hour") as mod_time from MyGuestBook"; |
|
#3
|
|||
|
|||
|
yeah!
thanks again Rod hehe |
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > about NOW() / PHP |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|