Method: Sequel::SequelMethods#convert_timestamp
- Defined in:
- lib/sequel/timezones.rb
#convert_timestamp(v, input_timezone) ⇒ Object
Converts the given object from the given input timezone to the application_timezone using convert_input_timestamp and convert_output_timestamp.
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/sequel/timezones.rb', line 84 def (v, input_timezone) if v.is_a?(Date) && !v.is_a?(DateTime) # Dates handled specially as they are assumed to already be in the application_timezone if datetime_class == DateTime DateTime.civil(v.year, v.month, v.day, 0, 0, 0, application_timezone == :local ? Rational(Time.local(v.year, v.month, v.day).utc_offset, 86400) : 0) else Time.public_send(application_timezone == :utc ? :utc : :local, v.year, v.month, v.day) end else ((v, input_timezone), application_timezone) end rescue InvalidValue raise rescue => e raise convert_exception_class(e, InvalidValue) end |