Date formatting a Ruby date from a .NET Webservice
I have a date coming through from a .NET webservice into my Rails app:
2011-05-09T10:57:00+01:00
What date format can I use with Date.strptime which would give me a reliable way o开发者_开发技巧f extracting the date?
Date and DateTime can handle this natively:
DateTime.parse "2011-05-09T10:57:00+01:00"
# => Mon, 09 May 2011 10:57:00 +0100
@Chowlett's answer is good Or you can also try out the "strptime" method on Date. It lets you parse a string in a know format of your choosing.
http://santoro.tk/mirror/ruby-core/classes/Date.html#M000643
精彩评论