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
Instance Attribute Summary
Attributes included from ISO8601DateModule
Attributes included from ISO8601TimeModule
#fractional_second, #hour, #minute, #second, #timezone
Instance Method Summary collapse
Methods included from ISO8601DateModule
#day_unknown?, #is_extended?, #is_partial?, #month_unknown?, #to_days
Methods included from ISO8601TimeModule
#has_fractional_second?, #is_decimal_sign_comma?, #is_extended?, #is_partial?, #minute_unknown?, #second_unknown?, #to_second
Instance Method Details
#as_string ⇒ Object
408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 |
# File 'lib/open_ehr/assumed_library_types.rb', line 408 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] unless @timezone.nil? s += @timezone end end end end end return s end |