Class: OraDate
- Inherits:
-
Object
- Object
- OraDate
- Defined in:
- lib/oci8/oci8.rb
Instance Method Summary collapse
-
#to_date ⇒ Object
Returns a Date object which denotes self.
-
#to_datetime ⇒ Object
Returns a DateTime object which denotes self.
-
#to_time ⇒ Object
Returns a Time object which denotes self.
Instance Method Details
#to_date ⇒ Object
Returns a Date object which denotes self.
459 460 461 |
# File 'lib/oci8/oci8.rb', line 459 def to_date Date.new(year, month, day) end |
#to_datetime ⇒ Object
Returns a DateTime object which denotes self.
Note that this is not daylight saving time aware. The Time zone offset is that of the time the command started.
473 474 475 |
# File 'lib/oci8/oci8.rb', line 473 def to_datetime DateTime.new(year, month, day, hour, minute, second, @@tz_offset) end |
#to_time ⇒ Object
Returns a Time object which denotes self.
449 450 451 452 453 454 455 456 |
# File 'lib/oci8/oci8.rb', line 449 def to_time begin Time.local(year, month, day, hour, minute, second) rescue ArgumentError msg = format("out of range of Time (expect between 1970-01-01 00:00:00 UTC and 2037-12-31 23:59:59, but %04d-%02d-%02d %02d:%02d:%02d %s)", year, month, day, hour, minute, second, Time.at(0).zone) raise RangeError.new(msg) end end |