Class: OraDate

Inherits:
Object
  • Object
show all
Defined in:
lib/oci8/oci8.rb

Instance Method Summary collapse

Instance Method Details

#to_dateObject

Returns a Date object which denotes self.



532
533
534
# File 'lib/oci8/oci8.rb', line 532

def to_date
  Date.new(year, month, day)
end

#to_datetimeObject

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.



544
545
546
# File 'lib/oci8/oci8.rb', line 544

def to_datetime
  DateTime.new(year, month, day, hour, minute, second, @@tz_offset)
end

#to_timeObject

Returns a Time object which denotes self.



522
523
524
525
526
527
528
529
# File 'lib/oci8/oci8.rb', line 522

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