Module: OpenEHR::AssumedLibraryTypes::ISO8601DateTimeModule
- Includes:
- ISO8601DateModule, ISO8601TimeModule
- Included in:
- ISO8601DateTime, RM::DataTypes::Quantity::DateTime::DvDateTime
- Defined in:
- lib/open_ehr/assumed_library_types.rb
Overview
end of ISO8601_TIME
Constant Summary
Constants included from TimeDefinitions
TimeDefinitions::DAYS_IN_LEAP_YEAR, TimeDefinitions::DAYS_IN_WEEK, TimeDefinitions::DAYS_IN_YEAR, TimeDefinitions::HOURS_IN_DAY, TimeDefinitions::MAX_DAYS_IN_MONTH, TimeDefinitions::MAX_DAYS_IN_YEAR, TimeDefinitions::MINUTES_IN_HOUR, TimeDefinitions::MONTH_IN_YEAR, TimeDefinitions::NOMINAL_DAYS_IN_MONTH, TimeDefinitions::NOMINAL_DAYS_IN_YEAR, TimeDefinitions::SECONDS_IN_MINUTE
Instance Attribute Summary
Attributes included from ISO8601DateModule
Attributes included from ISO8601TimeModule
#fractional_second, #hour, #minute, #second
Instance Method Summary collapse
Methods included from ISO8601DateModule
#day_unknown?, #is_extended?, #is_partial?, #month_unknown?, #to_days
Methods included from TimeDefinitions
valid_day?, valid_hour?, valid_minute?, valid_month?, valid_second?, valid_year?
Methods included from ISO8601TimeModule
#has_fractional_second?, #is_decimal_sign_comma?, #is_extended?, #is_partial?, #minute_unknown?, #second_unknown?, #timezone, #timezone=, #to_second
Instance Method Details
#as_string ⇒ Object
461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 |
# File 'lib/open_ehr/assumed_library_types.rb', line 461 def as_string if (!@year.nil? and !@month.nil? and !@day.nil?) s = Date.new(@year, @month, @day).to_s elsif (!@year.nil? and !@month.nil? and @day.nil?) return Date.new(@year, @month).to_s[0,7] elsif (!@year.nil? and @month.nil? and @day.nil?) return Date.new(@year).to_s[0,4] end unless hour.nil? s += sprintf("T%02d", @hour) unless @minute.nil? s += ":" + sprintf("%02d",@minute) unless @second.nil? s += ":" + sprintf("%02d", @second) unless @fractional_second.nil? s += "." + @fractional_second.to_s[2..-1] end end end unless @timezone.nil? s += @timezone.to_s end end return s end |