<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Timezone Issues with remote (Date/Time) data and flash</title>
	<atom:link href="http://www.axelscript.com/2008/06/24/timezone-issues-with-remote-datetime-data-and-flash-2/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.axelscript.com/2008/06/24/timezone-issues-with-remote-datetime-data-and-flash-2/</link>
	<description>Axel Jensen on Flex, Coldfusion and... other stuff</description>
	<pubDate>Tue, 18 Nov 2008 20:43:26 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
		<item>
		<title>By: Chris</title>
		<link>http://www.axelscript.com/2008/06/24/timezone-issues-with-remote-datetime-data-and-flash-2/#comment-1030</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Sun, 12 Oct 2008 21:16:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.axelscript.com/?p=143#comment-1030</guid>
		<description>We ran into this problem, I solved it by using getter / setter utility on the way to / from the  server.  What was happening is that our servers store data in local time to the server, and flex converts to local time implicity...therefore we are duplicating the conversion to local time.  

As a result, I need to check the incoming and outgoing dates and set appropriately for the users local time, and so the server perceives it as the appropriate time / date, especially important when the data is being used outside of the flex app, only.  

Here is a cut / pasted example of my utilities:  

/**
		 * I convert dates from DB / fluorine conversion
		 * to the appropriate time to be used on the 
		 * client side app.  The reason i am required
		 * is due to a bug between our data servers and
		 * the fluorine date conversion that implicitly 
		 * attempts to convert from UTC to local time
		**/
		public static function setDateOnGetFromDB(localDate:Date):Date{
			var offset:Number = localDate.getTimezoneOffset() * 60 * 1000;
			var UTCDate:Date = new Date(localDate.getTime() + offset);
			return UTCDate;
		}
		
		/**
		 * I do the opposite of setDateOnGetFromDB
		**/
		public static function setDatesOnSendToDB(UTCDate:Date):Date{
			var offset:Number = UTCDate.getTimezoneOffset() * 60 * 1000;
			var localDate:Date = new Date(UTCDate.getTime() - offset);
			return localDate;
		}</description>
		<content:encoded><![CDATA[<p>We ran into this problem, I solved it by using getter / setter utility on the way to / from the  server.  What was happening is that our servers store data in local time to the server, and flex converts to local time implicity&#8230;therefore we are duplicating the conversion to local time.  </p>
<p>As a result, I need to check the incoming and outgoing dates and set appropriately for the users local time, and so the server perceives it as the appropriate time / date, especially important when the data is being used outside of the flex app, only.  </p>
<p>Here is a cut / pasted example of my utilities:  </p>
<p>/**<br />
		 * I convert dates from DB / fluorine conversion<br />
		 * to the appropriate time to be used on the<br />
		 * client side app.  The reason i am required<br />
		 * is due to a bug between our data servers and<br />
		 * the fluorine date conversion that implicitly<br />
		 * attempts to convert from UTC to local time<br />
		**/<br />
		public static function setDateOnGetFromDB(localDate:Date):Date{<br />
			var offset:Number = localDate.getTimezoneOffset() * 60 * 1000;<br />
			var UTCDate:Date = new Date(localDate.getTime() + offset);<br />
			return UTCDate;<br />
		}</p>
<p>		/**<br />
		 * I do the opposite of setDateOnGetFromDB<br />
		**/<br />
		public static function setDatesOnSendToDB(UTCDate:Date):Date{<br />
			var offset:Number = UTCDate.getTimezoneOffset() * 60 * 1000;<br />
			var localDate:Date = new Date(UTCDate.getTime() - offset);<br />
			return localDate;<br />
		}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: PaulH</title>
		<link>http://www.axelscript.com/2008/06/24/timezone-issues-with-remote-datetime-data-and-flash-2/#comment-802</link>
		<dc:creator>PaulH</dc:creator>
		<pubDate>Wed, 25 Jun 2008 12:44:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.axelscript.com/?p=143#comment-802</guid>
		<description>not that you want to hear this but if your datetimes were entered in local times &#38; happen to fall on DST cusps then cf could also be chewing through your datetimes before they're inserted in the db (to cf, all datetimes are server tz datetimes). 

really your best bet is to either store epoch offsets (ms since 1-jan-1970 UTC) or do as ted suggests &#38; use UTC.

i suppose you could try pushing this back on the db server (eg sql server):


SELECT dateDiff(s,'1-jan-1970',yourDateTime)*1000. as testDate
FROM yourTable
</description>
		<content:encoded><![CDATA[<p>not that you want to hear this but if your datetimes were entered in local times &amp; happen to fall on DST cusps then cf could also be chewing through your datetimes before they&#8217;re inserted in the db (to cf, all datetimes are server tz datetimes). </p>
<p>really your best bet is to either store epoch offsets (ms since 1-jan-1970 UTC) or do as ted suggests &amp; use UTC.</p>
<p>i suppose you could try pushing this back on the db server (eg sql server):</p>
<p>SELECT dateDiff(s,&#8217;1-jan-1970&#8242;,yourDateTime)*1000. as testDate<br />
FROM yourTable</p>
]]></content:encoded>
	</item>
</channel>
</rss>
