In the console, when I fetch updated_at from a record, and check the 
class via the command

>>sim.updated_at.class

I get "ActiveSupport::TimeWithZone". Since it's a UTC time, I can 
use several of the commands from 
http://api.rubyonrails.org/classes/ActiveSupport/TimeWithZone.html#M0
00512 to convert this to the local time zone.

In my Flex code I have a ComboBox that has a dataProvider which is 
an mx:XMLListCollection of "sim" items. When I choose one of those 
using the ComboBox, I want to take the updated_at value and convert 
it from UTC to the local time zone.  However, none of the 
TimeWithZone conversion functions seem to work.  For example, the 
statement

trace("/" + userModelsCB.selectedItem.updated_at.getlocal + "/")

produces "//" in the trace file, as does everything else that I have 
tried. The commands work in the console, but not in my Flex code. 

If I just assign "userModelsCB.selectedItem.updated_at" to my text 
field, I get "2008-08-05T02:08:09Z", which is ugly and not very user 
friendly.  

Is there any way to get a TimeWithZone function that works in the 
console to work in my Flex code to get a nicely formatted date and 
time?

Thanks,
Louise




Reply via email to