Custom Serialization and AMF

AMF is a very efficient protocol, and part of that efficiency is thanks to the strict rules for supporting a limited set of data types in an optimized way. One of the most frequent cases in which it needs to be customized is when you have to work with non-UTC Date and Time. UTC stands for Coordinated Universal Time.

First, you need to understand how Flex deals with transfer of the Date objects. Dates are always transferred to/from Flex clients as UTC Date, where no time zone information is available on the object. Translation to the UTC/local time happens automatically on the AMF protocol level, which adds the client time zone offset to the incoming dates and subtracts it from outgoing ones.

The server does not know about the client’s time zone; it always operates in UTC time. This means that if a user from New York City entered 1:00 p.m. as the time, a user in Denver, Colorado, will see it as 11:00 a.m. In some applications, such behavior may be desirable, but this is not the case in a global application in which the users can be located around the world.

The user wants to enter the time in the client’s local time; 1:00 p.m. will be 1:00 p.m. regardless of the time zone of the person who entered this time.

For example, requests for an appointment for the installation of the local TV cable service may be handled by a call center located on the other side of the globe. Ashish from the call center talks to you, and if you agreed to see the cable guy at 10:00 ...

Get Agile Enterprise Application Development with Flex now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.