<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: AMFDateConverter &#8211; Convert PHP AMF to Flex Date Class</title>
	<atom:link href="http://natescodevault.com/?feed=rss2&#038;p=90" rel="self" type="application/rss+xml" />
	<link>http://natescodevault.com/?p=90</link>
	<description>from the dark recesses of an anxious mind</description>
	<lastBuildDate>Mon, 30 Aug 2010 15:12:10 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: DimiOrla</title>
		<link>http://natescodevault.com/?p=90&#038;cpage=1#comment-1671</link>
		<dc:creator>DimiOrla</dc:creator>
		<pubDate>Sat, 13 Mar 2010 09:03:21 +0000</pubDate>
		<guid isPermaLink="false">http://nateross.wordpress.com/?p=90#comment-1671</guid>
		<description>Hey Nate,
My knowledge level is not so far, as to understand what your doing I gust started playing with flex amfphp, I thing your AMFDateConverter could be the solution i am looking for.
I am trying to get records from my table between two dates with UTC Date timestamps.
[code]
     public function SelectReceiptsFilter ($Date1, $Date2)  {
     $query  = &quot;SELECT * FROM records_closed WHERE date BETWEEN &#039;$Date1&#039; AND &#039;$Date2&#039;&quot;;
     return mysql_query($query);
     }
If I hardcode ($Date1 = ’2010-03-11 00:00:00’;) the dates is php, I get the expected results in the browser.
 
Any ideas?
Thanks in advance
Dimitris.</description>
		<content:encoded><![CDATA[<p>Hey Nate,<br />
My knowledge level is not so far, as to understand what your doing I gust started playing with flex amfphp, I thing your AMFDateConverter could be the solution i am looking for.<br />
I am trying to get records from my table between two dates with UTC Date timestamps.<br />
[code]<br />
     public function SelectReceiptsFilter ($Date1, $Date2)  {<br />
     $query  = "SELECT * FROM records_closed WHERE date BETWEEN '$Date1' AND '$Date2'";<br />
     return mysql_query($query);<br />
     }<br />
If I hardcode ($Date1 = ’2010-03-11 00:00:00’;) the dates is php, I get the expected results in the browser.</p>
<p>Any ideas?<br />
Thanks in advance<br />
Dimitris.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ced</title>
		<link>http://natescodevault.com/?p=90&#038;cpage=1#comment-1639</link>
		<dc:creator>ced</dc:creator>
		<pubDate>Mon, 18 Jan 2010 13:55:39 +0000</pubDate>
		<guid isPermaLink="false">http://nateross.wordpress.com/?p=90#comment-1639</guid>
		<description>ZendAmf convert Dates from PHP datetime to AS3 Date Class.
But datetime is available only since PHP 5.2
There is still a lot of PHP 5.1.6 installations out there.

To use ZendAMF on those, you need to convert dates as integer before sending them.

I use a similar technique as yours with getters and setters</description>
		<content:encoded><![CDATA[<p>ZendAmf convert Dates from PHP datetime to AS3 Date Class.<br />
But datetime is available only since PHP 5.2<br />
There is still a lot of PHP 5.1.6 installations out there.</p>
<p>To use ZendAMF on those, you need to convert dates as integer before sending them.</p>
<p>I use a similar technique as yours with getters and setters</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nate</title>
		<link>http://natescodevault.com/?p=90&#038;cpage=1#comment-33</link>
		<dc:creator>Nate</dc:creator>
		<pubDate>Mon, 05 Jan 2009 03:01:17 +0000</pubDate>
		<guid isPermaLink="false">http://nateross.wordpress.com/?p=90#comment-33</guid>
		<description>@Carlos,

Ultimately that depends on how you are dealing with the data on the PHP backend. In some circumstances, you may want to multiply by 1000 on the PHP-end and if that is the case, the Flex-end might send a Number instead of a String.

This DateConverter class simply takes a few possible options that could be received from PHP and converts them to a Date class in Flex.

This DateConverter assumes any timestamp that it receives is based on &lt;a href=&quot;http://en.wikipedia.org/wiki/System_time&quot; rel=&quot;nofollow&quot;&gt;System time&lt;/a&gt;, or the number of milliseconds since the epoch (Jan 1, 1970).  Although you could easily modify the DateConverter to multiply by 1000 if you wish, I felt that this was a task more appropriate for PHP backend since Actionscript deals with timestamps differently than PHP&#039;s Unix Timestamp does.</description>
		<content:encoded><![CDATA[<p>@Carlos,</p>
<p>Ultimately that depends on how you are dealing with the data on the PHP backend. In some circumstances, you may want to multiply by 1000 on the PHP-end and if that is the case, the Flex-end might send a Number instead of a String.</p>
<p>This DateConverter class simply takes a few possible options that could be received from PHP and converts them to a Date class in Flex.</p>
<p>This DateConverter assumes any timestamp that it receives is based on <a href="http://en.wikipedia.org/wiki/System_time" rel="nofollow">System time</a>, or the number of milliseconds since the epoch (Jan 1, 1970).  Although you could easily modify the DateConverter to multiply by 1000 if you wish, I felt that this was a task more appropriate for PHP backend since Actionscript deals with timestamps differently than PHP&#8217;s Unix Timestamp does.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Carlos</title>
		<link>http://natescodevault.com/?p=90&#038;cpage=1#comment-34</link>
		<dc:creator>Carlos</dc:creator>
		<pubDate>Sun, 04 Jan 2009 22:34:48 +0000</pubDate>
		<guid isPermaLink="false">http://nateross.wordpress.com/?p=90#comment-34</guid>
		<description>i tried your funciton, but didn&#039;t work as fine as i&#039;d like.
here, you can see an alternative:
http://www.actionscript.org/forums/showthread.php3?p=755574

and so i did one function that receives a string (cause from amfphp it cames as string):

public function transformDate(timestamp_in_seconds:String):String
{
	//unix timestamp -&gt; human date
	var currDate:Date = new Date(parseInt(timestamp_in_seconds)*1000);
	//timestamp_in_seconds*1000 - if you use a result of PHP time function,
	//which returns it in seconds, and Flash uses milliseconds

	var D:int = currDate.getDate();
	var M:int = currDate.getMonth()+ 1;
	//because Returns the month (0 for January, 1 for February, and so on)
	var Y:int = currDate.getFullYear();
	var H:int = currDate.getHours();
	var N:int = currDate.getMinutes();
	var Min:String;
	if (N &lt;10) {
		 Min = &quot;0&quot; + N;
	}
	else {
		Min = N.toString();
	}
	var theDate:String = (M + &quot;/&quot; + D + &quot;/&quot; + Y + &quot; - &quot; + H + &quot;:&quot; + Min);
	return	theDate;
}</description>
		<content:encoded><![CDATA[<p>i tried your funciton, but didn&#8217;t work as fine as i&#8217;d like.<br />
here, you can see an alternative:<br />
<a href="http://www.actionscript.org/forums/showthread.php3?p=755574" rel="nofollow">http://www.actionscript.org/forums/showthread.php3?p=755574</a></p>
<p>and so i did one function that receives a string (cause from amfphp it cames as string):</p>
<p>public function transformDate(timestamp_in_seconds:String):String<br />
{<br />
	//unix timestamp -&gt; human date<br />
	var currDate:Date = new Date(parseInt(timestamp_in_seconds)*1000);<br />
	//timestamp_in_seconds*1000 &#8211; if you use a result of PHP time function,<br />
	//which returns it in seconds, and Flash uses milliseconds</p>
<p>	var D:int = currDate.getDate();<br />
	var M:int = currDate.getMonth()+ 1;<br />
	//because Returns the month (0 for January, 1 for February, and so on)<br />
	var Y:int = currDate.getFullYear();<br />
	var H:int = currDate.getHours();<br />
	var N:int = currDate.getMinutes();<br />
	var Min:String;<br />
	if (N &lt;10) {<br />
		 Min = &#8220;0&#8243; + N;<br />
	}<br />
	else {<br />
		Min = N.toString();<br />
	}<br />
	var theDate:String = (M + &#8220;/&#8221; + D + &#8220;/&#8221; + Y + &#8221; &#8211; &#8221; + H + &#8220;:&#8221; + Min);<br />
	return	theDate;<br />
}</p>
]]></content:encoded>
	</item>
</channel>
</rss>
