Andy11548 Posted March 2, 2012 Share Posted March 2, 2012 How do I set the date format so that it's always going by the UTC date? I've used: date_default_timezone_set('UTC'); but, when I change my date on my computer, the date changes on the website. This is really confusing me, googled different ways for like 10/20 minutes and can't find anything. If anyone can help it'd be great, Thanks, Andy. Quote Link to comment https://forums.phpfreaks.com/topic/258108-set-default-date/ Share on other sites More sharing options...
AyKay47 Posted March 2, 2012 Share Posted March 2, 2012 set the date.timezone directive in the master php.ini of your site. Using the date_default_timezone_set() function is a per-page basis. Is this localhost or a live server? Quote Link to comment https://forums.phpfreaks.com/topic/258108-set-default-date/#findComment-1323087 Share on other sites More sharing options...
Andy11548 Posted March 2, 2012 Author Share Posted March 2, 2012 ATM it's only localhost. I'm just testing and making things etc. Quote Link to comment https://forums.phpfreaks.com/topic/258108-set-default-date/#findComment-1323088 Share on other sites More sharing options...
AyKay47 Posted March 2, 2012 Share Posted March 2, 2012 my suggestions still stand. Quote Link to comment https://forums.phpfreaks.com/topic/258108-set-default-date/#findComment-1323089 Share on other sites More sharing options...
Andy11548 Posted March 2, 2012 Author Share Posted March 2, 2012 I did do that just now, and theres no difference? :S Quote Link to comment https://forums.phpfreaks.com/topic/258108-set-default-date/#findComment-1323091 Share on other sites More sharing options...
AyKay47 Posted March 2, 2012 Share Posted March 2, 2012 well, i'm really not sure since I haven't used localhost to test a site in a while. Your computer acts as the server, so perhaps it's just grabbing the time from it. I am sure someone else will chime in with a solution. But really, if this is localhost, it shouldn't be a huge deal. This problem will most likely not occur on a live server. Quote Link to comment https://forums.phpfreaks.com/topic/258108-set-default-date/#findComment-1323098 Share on other sites More sharing options...
Andy11548 Posted March 2, 2012 Author Share Posted March 2, 2012 Alright, thanks for the help anyways. The Time is working, if I change the time on my computer, it still shows the time as GMT (Europe/London), however, if I change the date it just echos the date set to my Computer, not the GMT date. If that gives you any more information, great. If not, thanks for the help anyways. Quote Link to comment https://forums.phpfreaks.com/topic/258108-set-default-date/#findComment-1323102 Share on other sites More sharing options...
Andy11548 Posted March 2, 2012 Author Share Posted March 2, 2012 Help still needed... Quote Link to comment https://forums.phpfreaks.com/topic/258108-set-default-date/#findComment-1323186 Share on other sites More sharing options...
Andy11548 Posted March 3, 2012 Author Share Posted March 3, 2012 How do I format the date so that if I change my computers date to say 10th March, it will still say todays date on the website? Thanks in Advance, Andy. Quote Link to comment https://forums.phpfreaks.com/topic/258108-set-default-date/#findComment-1323545 Share on other sites More sharing options...
APD1993 Posted March 3, 2012 Share Posted March 3, 2012 How do I format the date so that if I change my computers date to say 10th March, it will still say todays date on the website? Thanks in Advance, Andy. It seems that you are asking two different questions here. In terms of setting the Timezone, maybe this website will help http://php.net/manual/en/timezones.php Quote Link to comment https://forums.phpfreaks.com/topic/258108-set-default-date/#findComment-1323547 Share on other sites More sharing options...
Andy11548 Posted March 3, 2012 Author Share Posted March 3, 2012 I'm asking one question. The timezone sets the time to GMT, but doesn't affect the date, even if I change it through my PC. Quote Link to comment https://forums.phpfreaks.com/topic/258108-set-default-date/#findComment-1323548 Share on other sites More sharing options...
APD1993 Posted March 3, 2012 Share Posted March 3, 2012 I'm asking one question. The timezone sets the time to GMT, but doesn't affect the date, even if I change it through my PC. I do believe that there is a way that you can subtract a certain number of days that may be useful if your computer was to stay at the same time consistently. If the date was changed again, you may need to modify the script Quote Link to comment https://forums.phpfreaks.com/topic/258108-set-default-date/#findComment-1323549 Share on other sites More sharing options...
Andy11548 Posted March 3, 2012 Author Share Posted March 3, 2012 I'm asking one question. The timezone sets the time to GMT, but doesn't affect the date, even if I change it through my PC. I do believe that there is a way that you can subtract a certain number of days that may be useful if your computer was to stay at the same time consistently. If the date was changed again, you may need to modify the script No, I want it so that it goes by GMT all the time, no matter what I do to the date on my computer. This website has it done, I need to know how to do it. Quote Link to comment https://forums.phpfreaks.com/topic/258108-set-default-date/#findComment-1323575 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.