Class: Time
- Inherits:
-
Object
- Object
- Time
- Defined in:
- lib/ndr_support/date_and_time_extensions.rb,
lib/ndr_support/time/conversions.rb
Overview
Instance Method Summary collapse
-
#to_iso ⇒ Object
to_iso output must be SQL safe for security reasons.
- #to_ours ⇒ Object
-
#to_time ⇒ Object
Ruby 1.9 defines Time#to_time natively (as part of the stdlib Time, rather than core Time), but it returns the time in the local timezone.
Instance Method Details
#to_iso ⇒ Object
to_iso output must be SQL safe for security reasons
34 35 36 |
# File 'lib/ndr_support/date_and_time_extensions.rb', line 34 def to_iso strftime('%Y-%m-%dT%H:%M:%S') end |
#to_ours ⇒ Object
29 30 31 |
# File 'lib/ndr_support/date_and_time_extensions.rb', line 29 def to_ours strftime('%d.%m.%Y %H:%M') end |
#to_time ⇒ Object
Ruby 1.9 defines Time#to_time natively (as part of the stdlib Time, rather than core Time), but it returns the time in the local timezone. ActiveSupport contains the following definition, but it is only actually used by Ruby 1.8.7. We wish to continue with that behaviour, as local time zones have caused problems with our Time#to_s format (which either formats as ‘%d.%m.%Y %H:%M’ or ‘%d.%m.%Y’).
10 11 12 |
# File 'lib/ndr_support/time/conversions.rb', line 10 def to_time self end |