How do I convert a Rails DateTime object to an XML string?
Time to XML format:
Time.now.xmlschema # implemented by Rails, not stock rubyTime.now.strftime '%Y-%m-%dT%H:%M:%S%z'
http://corelib.rubyonrails.org/classes/Time.html#M000281
To parse (Ruby 1.9 and beyond):
t = Time.now.xmlschema(str)
Here's a pure-Ruby way:
Time.now.strftime("%Y-%m-%dT%H:%M:%S%z")
You can get more details about the various strftime options with:
ri Time.strftime