1. Understand how date and time are determined by flex (player on the client machine)
From flex doc we can see:
“The Date class lets you retrieve date and time values relative to universal time (Greenwich mean time, now called universal time or UTC) or relative to local time, which is determined by the local time zone setting on the operating system that is running Flash Player. ”
This mean if one user’s machine is using “Automatically adjust clock for daylight saving changes”, the time displaied in flex app may be different with another user who is running the same flex app without “Automatically adjust clock for daylight saving changes” on his machine.
“Automatically adjust clock for daylight saving changes” can be checked from
Control Panel –> Date and time –>Time Zone.
2. Understand how date and time are determined by Java ( On server machine)
1). The JVM determines the correct Coordinated Universal Time (UTC) by comparing the QUTCOFFSET value to the local time for the system
The JVM returns the correct local time to the system by using the Java system property user.timezone.
The default value for QUTCOFFSET is zero (+00:00).
The QUTCOFFSET value allows the JVM to determine the correct value for the local time. For example, the value for QUTCOFFSET to specify central standard time (CST) is -6:00. To specify central daylight time (CDT), QUTCOFFSET has a value of -5:00.
The user.timezone Java system property uses UTC time as the default value. Unless you specify a different value, the JVM recognizes UTC time as the current time.
See more details in here
2). you need correct patches for Java to get correc date and time.
— There is a patch for jdk you may want to double check:
— if you are using Solaris, you may need this patch
— if you are using 1.4.2_10 or lower version of JDK, you need this patch
3). To verify your time zone setting in JDK, read this
Download time.jsp from there, and run it on your server.
To change timezone setting in Java, you can use java arg:
If you are using Jrun as app sever, this can be change in JRun_install/bin/jvm.config file:
java.args=-Xms32m -Xmx384m -Dsun.io.useCanonCaches=false -Duser.timezone=Etc/UCT
3. synchronize time znoe on client and server
If you want to enter time in the client’s local time – regardless of the timezone your in at the time of data entry, and keep the date in UTC zone on both server and client side, see example
Note, don’t forget you also need to set JAVA VM timezone to UTC for this example.