Jump to content

[SOLVED] Dates


Jonob

Recommended Posts

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.  :facewall:

 

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.