Jonob Posted August 13, 2009 Share Posted August 13, 2009 Hi all, I have an adobe flex app with a php/mysql backend, running through an amfphp service. I am having problems where the flex client sends dates back to to php services where the client and server are in different timezones. Some more information: flash/flex dates are the same as php Unix timestamp (i.e. strtotime), except that it has 4 additional integers (i.e. it can cater for milliseconds). So, to convert a flash time to php, all you need to do is divide by 1000. For example, server is based in the UK, and a client is located in a timezone 9 hours ahead. When a date of 01 Aug 2009 is sent through, the server converts this into 31 July 2009. Using Charles Proxy, I can clearly see that the correct date (01 Aug 2009 is sent through), but by the time that amfphp has unserialized this, its been changed to 31 July 2009. More specifically, I can see that the exact timestamp in php has been set to 31 July 2009 15:00:00 , which is exactly 9 hours before the client. Any ideas on how to stop php or amfphp messing with the dates like this? Any help greatly appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/170107-solved-dates/ Share on other sites More sharing options...
Mark Baker Posted August 13, 2009 Share Posted August 13, 2009 Manage all your dates as GMT, both in Flash/Flex and PHP/MySQL Quote Link to comment https://forums.phpfreaks.com/topic/170107-solved-dates/#findComment-897342 Share on other sites More sharing options...
Jonob Posted August 13, 2009 Author Share Posted August 13, 2009 Thanks for the reply Mark. Sorry, I am a bit new to this kind of thing...would you mind explaining a bit more? Quote Link to comment https://forums.phpfreaks.com/topic/170107-solved-dates/#findComment-897361 Share on other sites More sharing options...
Jonob Posted August 13, 2009 Author Share Posted August 13, 2009 Managed to solve this... The problem is that flex sends through a Date object, which includes timezone, but amfphp seems to discard this, and only gives a timestamp of the equivalant server time. I managed to solve this by sending through the clients timezone when logging in, and then offsetting any dates coming in from the client by that timezone differential. Quote Link to comment https://forums.phpfreaks.com/topic/170107-solved-dates/#findComment-897609 Share on other sites More sharing options...
Mark Baker Posted August 14, 2009 Share Posted August 14, 2009 Glad you managed to figure it out Quote Link to comment https://forums.phpfreaks.com/topic/170107-solved-dates/#findComment-897938 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.