Search the web
Sign In
New User? Sign Up
RubyOnRails · Ruby on Rails
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Date format conversion problem   Message List  
Reply | Forward Message #74 of 107 |
Hi,

I generate in RoR an XML file representing Oracle database data, which
is then sent to an Adobe Flex UI as an HTTP Web Service. In order to
format DATES in a way that Flex understands, I add the following code
to environment.rb :

ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.merge!
( :flex => '%a %b %d %H:%M:%S %Y' )

Then, I temporarily modify the formatting of my datetime data, in this
function :

def list_timespan_flexdateformat_xml
old_proc = Hash::XML_FORMATTING['datetime']
Hash::XML_FORMATTING['datetime'] = Proc.new { |datetime|
datetime.to_s(:flex2) }

@rv_wrk_calendar_events = RvWrkCalendarEvent.find(
:all, :conditions =>
[ "start_date >= ? and start_date <= ?",

params[:min_start_date], params[:max_start_date]])
render :xml => @rv_wrk_calendar_events.to_xml

Hash::XML_FORMATTING['datetime'] = old_proc
end

This works well for all Oracle DATE fields that contain TIME
information. But for some mysterious reason, it doesn't work when the
DATE field doesn't contain TIME information. The only meager result is
that some formats (e.g., '%Y %m %d', '%Y/%m/%d' or '%Y-%m-%d')
generate this :

<start_date type="datetime">2007-08-23</start_date>

instead of the default :

<start_date type="datetime">2007-08-23T00:00:00+02:00</start_date>

I tried replacing "datetime" with "time" in the code above, to no
avail...

I know I can eventually parse the date in Flex, but this problem is
driving me crazy!

Chris.




Fri Aug 31, 2007 8:11 am

gers32
Offline Offline
Send Email Send Email

Forward
Message #74 of 107 |
Expand Messages Author Sort by Date

Hi, I generate in RoR an XML file representing Oracle database data, which is then sent to an Adobe Flex UI as an HTTP Web Service. In order to format DATES in...
gers32
Offline Send Email
Aug 31, 2007
12:20 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help