method
to_s
v7.2.3 -
Show latest stable
-
2 notes -
Class: ActiveSupport::TimeWithZone
- 1.0.0
- 1.1.6
- 1.2.6
- 2.0.3
- 2.1.0 (0)
- 2.2.1 (0)
- 2.3.8 (0)
- 3.0.0 (0)
- 3.0.9 (-1)
- 3.1.0 (0)
- 3.2.1 (0)
- 3.2.8 (0)
- 3.2.13 (0)
- 4.0.2 (0)
- 4.1.8 (0)
- 4.2.1 (25)
- 4.2.7 (0)
- 4.2.9 (0)
- 5.0.0.1 (-1)
- 5.1.7 (0)
- 5.2.3 (0)
- 6.0.0 (0)
- 6.1.3.1 (0)
- 6.1.7.7 (0)
- 7.0.0 (-38)
- 7.1.3.2 (0)
- 7.1.3.4 (0)
- 7.2.3 (0)
- 8.0.0 (0)
- 8.1.1 (0)
- What's this?
Register or
log in
to add new notes.
shadowfiend -
November 24, 2008 - (<= v2.2.1)
hosiawak -
August 17, 2009
7 thanks
Full List of Supported Formats
With a sample date of December 25th, 2008, at 14:35:05:
:db # => 2008-12-25 14:35:05 :number # => 20081225143505 :time # => 14:35 :short # => 25 Dec 14:35 :long # => December 25, 2008 14:35 :long_ordinal # => December 25th, 2008 14:35 :rfc822 # => Thu, 25 Dec 2008 14:35:05 +0000
1 thank
Time in fixtures
When creating fixtures you should use this method to set created_at/updated_at timestamps correctly:
eg:
This won’t work as expected (created_at/updated_at will be nil) a
one: episode: active1 play_id: 1 play_time: 20 country: United Kingdom created_at: <%= Time.parse('22:00 14 Aug 2009') %> updated_at: <%= Time.parse('22:00 14 Aug 2009') %>
but this will work as expected:
one: episode: active1 play_id: 1 play_time: 20 country: United Kingdom created_at: <%= Time.parse('22:00 14 Aug 2009').to_s(:db) %> updated_at: <%= Time.parse('22:00 14 Aug 2009').to_s(:db) %>

