Method: RubyUnits::Unit#to_datetime

Defined in:
lib/ruby_units/unit.rb

#to_datetime::DateTime

convert a duration to a DateTime. This will work so long as the duration is the duration from the zero date defined by DateTime

Returns:

  • (::DateTime)


1403
1404
1405
# File 'lib/ruby_units/unit.rb', line 1403

def to_datetime
  DateTime.new!(convert_to("d").scalar)
end