method

to_s

v2_5_5 - Show latest stable - Class: DateTime
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"

1Note

Output format

szeryf · Feb 10, 2009

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 :)