diff options
Diffstat (limited to 'activesupport/lib/active_support/core_ext/time/conversions.rb')
-rw-r--r-- | activesupport/lib/active_support/core_ext/time/conversions.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/time/conversions.rb b/activesupport/lib/active_support/core_ext/time/conversions.rb index f2ff0e06a8..903dd02031 100644 --- a/activesupport/lib/active_support/core_ext/time/conversions.rb +++ b/activesupport/lib/active_support/core_ext/time/conversions.rb @@ -28,6 +28,11 @@ module ActiveSupport #:nodoc: def to_time self end + + # converts to a Ruby DateTime instance; preserves utc offset + def to_datetime + ::DateTime.civil(year, month, day, hour, min, sec, Rational(utc_offset, 86400), 0) + end end end end |