beav33 Posted February 4, 2007 Share Posted February 4, 2007 Need Help. Now on my website my echo date is showing it as the 4 of feb. I was wondering is there anyway to make it per time zone for different customers areas. code <?php echo date('M d, Y');?>Please help if possible thank you beav33 Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted February 4, 2007 Share Posted February 4, 2007 you would need to get there timezone difference then work it out from there. Quote Link to comment Share on other sites More sharing options...
beav33 Posted February 4, 2007 Author Share Posted February 4, 2007 I'm not even sure what time zone the codes going off of if its showing the 4 of feb already. So lets say central U.S., thats where I reside. Quote Link to comment Share on other sites More sharing options...
tauchai83 Posted February 4, 2007 Share Posted February 4, 2007 it's time consuming to code for that..why don u just use a standard one for all? i'm pretty sure the user not really care about it (timezone). just follow GMT will do.... Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted February 4, 2007 Share Posted February 4, 2007 it would be your server's time. so find out what your servers time zone is. then grab the users time zone and + or - the correct amount to get there time. Â it's time consuming to code for that..why don u just use a standard one for all? i'm pretty sure the user not really care about it (timezone). just follow GMT will do.... some people prefer to show dates in the users timezone. it wouldnt really take to much extra code either. Quote Link to comment Share on other sites More sharing options...
tauchai83 Posted February 4, 2007 Share Posted February 4, 2007 what i mean is that we got a lot of other important function to implement...spending time in this a waste for me in my opinion...but is ok....good luck.... Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted February 4, 2007 Share Posted February 4, 2007 what i mean is that we got a lot of other important function to implement...spending time in this a waste for me in my opinion...but is ok....good luck.... Â i can see where your coming from, it may seem like a waste of time. but it has a lot of benefits. It is a lot more user friendly, because some users can become very confused about the time. Quote Link to comment Share on other sites More sharing options...
ted_chou12 Posted February 4, 2007 Share Posted February 4, 2007 this will help you, took me a while to figure this out, and luckly, i think is in your timezone, so you dont have to change the figures: <?php $timezones = array( '-25200' => 'International Date Line (West) GMT-12', '-21600' => 'Midway Island, Samoa GMT-11', '-18000' => 'Hawaii, Honolulu GMT-10', '-14400' => 'Alaska GMT-9', '-10800' => 'Pacific Standard Time, US, Canada GMT-8', '-7200' => 'British Columbia N.E., Santa Fe, Mountain Time GMT-7', '-3600' => 'Central America, Chicago, Guatamala, Mexico City GMT-6', '0' => 'US, Canada, Bogota, Boston, New York GMT-5', '+3600' => 'Canada, Santiago, Atlantic Standard Time GMT-4', '+7200' => 'Brazilia, Buenos Aires, Georgetown, Greenland GMT-3', '+10800' => 'Mid-Atlantic GMT-2', '+14400' => 'Azores, Cape Verde Is., Western Africa Time GMT-1', '+18000' => 'London, Iceland, Ireland, Morocco, Portugal GMT', '+21600' => 'Amsterdam, Berlin, Bern, Madrid, Paris, Rome, GMT+1', '+25200' => 'Athens, Cairo, Cape Town, Finland, Greece, Israel GMT+2', '+28800' => 'Ankara, Aden, Baghdad, Beruit, Kuwait, Moscow GMT+3', '+32400' => 'Abu Dhabi, Baku, Kabul, Tehran, Tbilisi, Volgograd GMT+4', '+36000' => 'Calcutta, Colombo, Islamabad, Madras, New Dehli GMT+5', '+39600' => 'Almaty, Dhakar, Kathmandu, Colombo, Sri Lanka GMT+6', '+43200' => 'Bangkok, Hanoi, Jakarta, Phnom Penh, Australia GMT+7', '+46800' => 'Taipei, Beijing, Hong Kong, Singapore, GMT+8', '+50400' => 'Seoul, Tokyo, Central Australia GMT+9', '+54000' => 'Brisbane, Canberra, Guam, Melbourne, Sydney, GMT+10', '+57600' => 'Magadan, New Caledonia, Solomon Is. GMT+11', '+61200' => 'Auckland, Fiji, Kamchatka, Marshall, Wellington, GMT+12',); ?> what you have to do is to: $time = strtotime{"now"); $time = $time + $timeoffset//which of the figure above^ echo date("H:i:s", $time); Ted Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted February 4, 2007 Share Posted February 4, 2007 wow thats a nice list ted... did you make that list yourself? Quote Link to comment Share on other sites More sharing options...
ted_chou12 Posted February 4, 2007 Share Posted February 4, 2007 yeah, i did, searched the main cities and the time zones on google. Quote Link to comment Share on other sites More sharing options...
beav33 Posted February 7, 2007 Author Share Posted February 7, 2007 Ok on a new mission. Killed the time issue and will address it later, but I still want the date to be on central U.S. Yahoo goes off international Greenwich. So how do I subtract 6 hours with this code. <?php echo date('M d, Y');?> Thanks Beav33 Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 7, 2007 Share Posted February 7, 2007 echo date("M d, Y", time()-(60*60*6)); Quote Link to comment Share on other sites More sharing options...
beav33 Posted February 7, 2007 Author Share Posted February 7, 2007 You Rock, Thank You Beav33 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.