aquatsr Posted September 22, 2006 Share Posted September 22, 2006 I input the date a new record is added by using the NOW() function in MySQL. The problem is that the server time is 3 hours ahead of local time, and I want to display the dates using php in my timezone. How do I do that while still using NOW()Also, if I wanted to display the date in the user's local timezone, how would I do that? Link to comment Share on other sites More sharing options...
redsun Posted September 23, 2006 Share Posted September 23, 2006 You can take off any value you need, for example: (NOW() - 20).The number '20' depends on you database field data format (DATETIME, DATE, TIMESTAMP, TIME). Link to comment Share on other sites More sharing options...
aquatsr Posted September 24, 2006 Author Share Posted September 24, 2006 You can take off any value you need, for example: (NOW() - 20).The number '20' depends on you database field data format (DATETIME, DATE, TIMESTAMP, TIME).OK. Say the field is DATE and I want to take off 3 hours? Link to comment Share on other sites More sharing options...
redsun Posted September 24, 2006 Share Posted September 24, 2006 Try to run this: SELECT now() AS "current time"SELECT now()-30000 AS "current time minus 3 hours" See the difference? I hope so ;o) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now