kee2ka4 Posted June 18, 2008 Share Posted June 18, 2008 I am thinking of using the CONVERT_TZ(dt,from_tz,to_tz) function of MySql that converts the from-timezone 'from_tz' into the to-timezone 'to_tz', basically I want the convert the hosting companys timezone into the london timezone, so that the NOW() function displays correct value. Could anyone tell me how can I find out the hosting company's timezone or is there any default timezone I can use. I just want the clerify the values I enter in the variable 'from_tz' and 'to_tz'. I think the values for to_tz is Europe/London or GB, but not sure! Thanks, Ket Quote Link to comment Share on other sites More sharing options...
fenway Posted June 18, 2008 Share Posted June 18, 2008 If you set the client timezone differently from the server timezone, mysql will do this for you. Quote Link to comment Share on other sites More sharing options...
kee2ka4 Posted June 18, 2008 Author Share Posted June 18, 2008 Hey Fenway, Thanks for your message If you set the client timezone differently from the server timezone, mysql will do this for you. I am not sure how to do the above in MySql I have a query that pulls the post.created_at field and formats the day, month and time, using the date_format() function. Here is the query: $query = "select posts.id as id, posts.body, date_format(posts.created_at, '%d') as formatday, date_format(posts.created_at, '%b') as formatmonth, date_format(posts.created_at, '%H:%i') as formattime, posts.user_id, users.name from posts, users where posts.user_id = users.id order by posts.id desc"; How do I convert the time to the UK time since the Timezone on the hosting server is CDT, and I need the GMT to display the correct london time. If you think Convert_tz() is the correct function to use, how can I use it in the above query. Thanks, Ket Quote Link to comment Share on other sites More sharing options...
fenway Posted June 18, 2008 Share Posted June 18, 2008 Have you read this? Quote Link to comment Share on other sites More sharing options...
kee2ka4 Posted June 19, 2008 Author Share Posted June 19, 2008 Hey Fenway, Thanks for your reply.. I did read the article but I didn't quite understand it, I guess I am just dumb . I didn't get the bit on how can I set the session timezone and the global timezone. Since I use PhpMyAdmin to manage my whole database, I do not know anything abt using the mysql command prompt as shown in the article. I did try using the convert_tz() as mentioned in the end but it didnt work. Actually I am lost lolz. Could you guide me? ??? Thanks, Ket Quote Link to comment Share on other sites More sharing options...
fenway Posted June 19, 2008 Share Posted June 19, 2008 Yes, but each script is effectively a "session". Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.