Module: HL7Time
Instance Method Summary collapse
-
#to_hl7(fraction_digits = 0) ⇒ Object
Get a HL7 timestamp (type TS) for a Time instance.
Instance Method Details
#to_hl7(fraction_digits = 0) ⇒ Object
Get a HL7 timestamp (type TS) for a Time instance.
- fraction_digits
-
specifies a number of digits of fractional seconds. Its default value is 0.
Time.parse('01:23').to_hl7
=> "20091202012300"
Time.now.to_hl7(3)
=> "20091202153652.302"
12 13 14 |
# File 'lib/core_ext/date_time.rb', line 12 def to_hl7(fraction_digits = 0) strftime("%Y%m%d%H%M%S") + hl7_fractions(fraction_digits) end |