To_xml and timezones

When i call model_object.to_xml, there is a DateTime field and it’s
displayed as such: 2009-08-25T16:32:06Z

Is there anyway to modify the display format to say the format like
Time.now.utc?, i.e. 2009-09-09 03:14:20 UTC

thanks

Allen W. wrote:

When i call model_object.to_xml, there is a DateTime field and it’s
displayed as such: 2009-08-25T16:32:06Z

Is there anyway to modify the display format to say the format like
Time.now.utc?, i.e. 2009-09-09 03:14:20 UTC

thanks

Time formats in XML are standardized and Rails uses the standard. I
would highly recommend you NOT change it. The model layer should not be
responsible for date/time formats anyway. Let you views do their job.

http://www.w3.org/TR/xmlschema-2/#dateTime

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs