Re: [flexcoders] AMFPHP and date/datetime data from MySQL
Guys Any points about this ? - Original Message From: Sajid Hussain [EMAIL PROTECTED] To: flexcoders@yahoogroups.com Sent: Wednesday, September 3, 2008 4:55:46 PM Subject: Re: [flexcoders] AMFPHP and date/datetime data from MySQL Guys , I also need some help on this thing I m not getting exactly how to get this thing solved if is there any way to transform flex date objects to php through amfphp ,same as reverse it will be great right now I m storing date in php as dateandtime object and fetching as string into flex but it get transform into this date strored in mysql 2001-12-13 in flex as string it comees like this : 12/13/01 Any sugestion how to have this as in corect way or if I could convert 12/13/01 this string to dateobject Sajid - Original Message From: Nik Derewianka [EMAIL PROTECTED] com To: [EMAIL PROTECTED] ups.com Sent: Wednesday, September 3, 2008 4:31:25 PM Subject: Re: [flexcoders] AMFPHP and date/datetime data from MySQL On 04/09/2008, at 12:01 AM, Jason Reynolds wrote: Adobe has some date parsing methods in the as3corelib library -- http://code. google.com/ p/as3corelib/ I suppose it depends on the format your storing the date, the way I've been handling it is using as3 to parse the date string that AMF returns. Not sure if this is the best way, I'd be open to a better one! Yeah, I am at the point where i will try populating the string of the date (php side) in a throw away prop and then on successful load coerce it into a true date object in the real prop that is then used for binding. But was hoping that if i got it in the right format serverside then the amf deserialization would just take care of it without having to write the converter code. The MySQL columns are date and datetime so there shouldn't be anything funky going on with the storage. Hope that helps, I can attempt to help more if it doesn't. I've been using AMFPHP for awhile now... would be nice to make any contacts that use it! Heh - i'll just say that it has been an... adventurous. .. experience getting upto speed on amfphp (or remoting of any kind for that matter). But now that it is mostly working, it is pretty sweet. I just hope to get the time to write up a comprehensive overview of all the pitfalls and assorted tidbits i found all over the net. Cheers, Nik
Re: [flexcoders] AMFPHP and date/datetime data from MySQL
The Flex documentation says there is a DateFormatter class. Have you tried using that? On Thu, Sep 4, 2008 at 5:10 AM, Sajid Hussain [EMAIL PROTECTED]wrote: Guys Any points about this ? - Original Message From: Sajid Hussain [EMAIL PROTECTED] To: flexcoders@yahoogroups.com Sent: Wednesday, September 3, 2008 4:55:46 PM Subject: Re: [flexcoders] AMFPHP and date/datetime data from MySQL Guys , I also need some help on this thing I m not getting exactly how to get this thing solved if is there any way to transform flex date objects to php through amfphp ,same as reverse it will be great right now I m storing date in php as dateandtime object and fetching as string into flex but it get transform into this date strored in mysql 2001-12-13 in flex as string it comees like this : 12/13/01 Any sugestion how to have this as in corect way or if I could convert 12/13/01 this string to dateobject Sajid -- Howard Fore, [EMAIL PROTECTED] The universe tends toward maximum irony. Don't push it. - Jeff Atwood
Re: [flexcoders] AMFPHP and date/datetime data from MySQL
Sajid, Still under a tight deadline atm, but this is what i have working for me so far: To write it to DB: public function create($obj) { $query = INSERT INTO Event ( DateStart, ) VALUES ( '.date(Y-m-d,mysql_real_escape_string($obj[DateStart])/1000).' To read it back out - the query: public function getOne($id) { $query = SELECT date_format(DateStart, '%a %b %e %T GMT+1000 %Y') as DateStart, Which will format the string exactly as new Date() outputs for me (couldn't quickly find a way to get the timezone + offset so it's hard coded). Then in my VO which is sent back via amf: ?php class EventsVO { var $_explicitType=vo.EventsVO; public $_DateStart; public function EventsVO() { } public function mapObject($data) { $this-_DateStart = $data[DateStart]; } } ? Take note that I have prepended the VO DateStart field with an underscore, the reason for this is apparent in the .as VO below: package com.aom.mfl.vo { [RemoteClass(alias=vo.EventsVO)] [Bindable] public class SEvent { public var _DateStart:String; public function SEvent() { } public function set DateStart(val:Date):void{ _DateStart = val.toString(); } public function get DateStart():Date{ if (_DateStart == null){ return new Date(); } return new Date(_DateStart); } } } Effectively the remoting will set the string of _DateStart but all other code throughout my flex app will refer to DateStart which returns the true Date object, you could create another private field to hold the Date object instead of parsing the string version on each request. Cheers, Nik
[flexcoders] AMFPHP and date/datetime data from MySQL
Hi All, Could anyone enlighten me as to how i should send and retrieve date and datetime data for inserting into MySQL via amfphp (1.9) with value objects ? If i edit the data directly in MySQL and then retrieve a vo with a Date datatype i get the following message: TypeError: Error #1034: Type Coercion failed: cannot convert 1970-01-01 to Date. So, I need to format the date in someway so that flex can deserialize it properly. Any insight would be greatly appreciated (am coming from .net land so new to both PHP and as3). Cheers, Nik
Re: [flexcoders] AMFPHP and date/datetime data from MySQL
Adobe has some date parsing methods in the as3corelib library -- http://code.google.com/p/as3corelib/ I suppose it depends on the format your storing the date, the way I've been handling it is using as3 to parse the date string that AMF returns. Not sure if this is the best way, I'd be open to a better one! Hope that helps, I can attempt to help more if it doesn't. I've been using AMFPHP for awhile now... would be nice to make any contacts that use it! - Original Message - From: Nik Derewianka To: flexcoders@yahoogroups.com Sent: Wednesday, September 03, 2008 6:00 AM Subject: [flexcoders] AMFPHP and date/datetime data from MySQL Hi All, Could anyone enlighten me as to how i should send and retrieve date and datetime data for inserting into MySQL via amfphp (1.9) with value objects ? If i edit the data directly in MySQL and then retrieve a vo with a Date datatype i get the following message: TypeError: Error #1034: Type Coercion failed: cannot convert 1970-01-01 to Date. So, I need to format the date in someway so that flex can deserialize it properly. Any insight would be greatly appreciated (am coming from .net land so new to both PHP and as3). Cheers, Nik __ Information from ESET NOD32 Antivirus, version of virus signature database 3411 (20080903) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com
Re: [flexcoders] AMFPHP and date/datetime data from MySQL
On 04/09/2008, at 12:01 AM, Jason Reynolds wrote: Adobe has some date parsing methods in the as3corelib library -- http://code.google.com/p/as3corelib/ I suppose it depends on the format your storing the date, the way I've been handling it is using as3 to parse the date string that AMF returns. Not sure if this is the best way, I'd be open to a better one! Yeah, I am at the point where i will try populating the string of the date (php side) in a throw away prop and then on successful load coerce it into a true date object in the real prop that is then used for binding. But was hoping that if i got it in the right format serverside then the amf deserialization would just take care of it without having to write the converter code. The MySQL columns are date and datetime so there shouldn't be anything funky going on with the storage. Hope that helps, I can attempt to help more if it doesn't. I've been using AMFPHP for awhile now... would be nice to make any contacts that use it! Heh - i'll just say that it has been an... adventurous... experience getting upto speed on amfphp (or remoting of any kind for that matter). But now that it is mostly working, it is pretty sweet. I just hope to get the time to write up a comprehensive overview of all the pitfalls and assorted tidbits i found all over the net. Cheers, Nik
Re: [flexcoders] AMFPHP and date/datetime data from MySQL
Guys , I also need some help on this thing I m not getting exactly how to get this thing solved if is there any way to transform flex date objects to php through amfphp ,same as reverse it will be great right now I m storing date in php as dateandtime object and fetching as string into flex but it get transform into this date strored in mysql 2001-12-13 in flex as string it comees like this : 12/13/01 Any sugestion how to have this as in corect way or if I could convert 12/13/01 this string to dateobject Sajid - Original Message From: Nik Derewianka [EMAIL PROTECTED] To: flexcoders@yahoogroups.com Sent: Wednesday, September 3, 2008 4:31:25 PM Subject: Re: [flexcoders] AMFPHP and date/datetime data from MySQL On 04/09/2008, at 12:01 AM, Jason Reynolds wrote: Adobe has some date parsing methods in the as3corelib library -- http://code. google.com/ p/as3corelib/ I suppose it depends on the format your storing the date, the way I've been handling it is using as3 to parse the date string that AMF returns. Not sure if this is the best way, I'd be open to a better one! Yeah, I am at the point where i will try populating the string of the date (php side) in a throw away prop and then on successful load coerce it into a true date object in the real prop that is then used for binding. But was hoping that if i got it in the right format serverside then the amf deserialization would just take care of it without having to write the converter code. The MySQL columns are date and datetime so there shouldn't be anything funky going on with the storage. Hope that helps, I can attempt to help more if it doesn't. I've been using AMFPHP for awhile now... would be nice to make any contacts that use it! Heh - i'll just say that it has been an... adventurous. .. experience getting upto speed on amfphp (or remoting of any kind for that matter). But now that it is mostly working, it is pretty sweet. I just hope to get the time to write up a comprehensive overview of all the pitfalls and assorted tidbits i found all over the net. Cheers, Nik
Re: [flexcoders] AMFPHP and date/datetime data from MySQL
Guys , I also need some help on this thing I m not getting exactly how to get this thing solved if is there any way to transform flex date objects to php through amfphp ,same as reverse it will be great right now I m storing date in php as dateandtime object and fetching as string into flex but it get transform into this date strored in mysql 2001-12-13 in flex as string it comees like this : 12/13/01 Any sugestion how to have this as in corect way or if I could convert 12/13/01 this string to dateobject Sajid - Original Message From: Nik Derewianka [EMAIL PROTECTED] To: flexcoders@yahoogroups.com Sent: Wednesday, September 3, 2008 4:31:25 PM Subject: Re: [flexcoders] AMFPHP and date/datetime data from MySQL On 04/09/2008, at 12:01 AM, Jason Reynolds wrote: Adobe has some date parsing methods in the as3corelib library -- http://code. google.com/ p/as3corelib/ I suppose it depends on the format your storing the date, the way I've been handling it is using as3 to parse the date string that AMF returns. Not sure if this is the best way, I'd be open to a better one! Yeah, I am at the point where i will try populating the string of the date (php side) in a throw away prop and then on successful load coerce it into a true date object in the real prop that is then used for binding. But was hoping that if i got it in the right format serverside then the amf deserialization would just take care of it without having to write the converter code. The MySQL columns are date and datetime so there shouldn't be anything funky going on with the storage. Hope that helps, I can attempt to help more if it doesn't. I've been using AMFPHP for awhile now... would be nice to make any contacts that use it! Heh - i'll just say that it has been an... adventurous. .. experience getting upto speed on amfphp (or remoting of any kind for that matter). But now that it is mostly working, it is pretty sweet. I just hope to get the time to write up a comprehensive overview of all the pitfalls and assorted tidbits i found all over the net. Cheers, Nik