to_s() public

Returns a string in an ISO 8601 format. (This method doesn’t use the expanded representations.)

DateTime.new(2001,2,3,4,5,6,'-7').to_s
                         #=> "2001-02-03T04:05:06-07:00"
Show source
Register or log in to add new notes.
February 10, 2009
0 thanks

Output format

This outputs date & time in format of yyyy-MM-ddThh-mm-ssZZZ. All values are preceded with 0 if less than 10. Hours are in 0..23 range. Timezone is sticked at the end. Watch out for capital T in the middle :)