Class: HealthDataStandards::Util::HL7Helper
- Inherits:
-
Object
- Object
- HealthDataStandards::Util::HL7Helper
- Defined in:
- lib/health-data-standards/util/hl7_helper.rb
Overview
General helpers for working with HL7 data types
Class Method Summary collapse
-
.timestamp_to_integer(timestamp) ⇒ Integer
Converts an HL7 timestamp into an Integer.
Class Method Details
.timestamp_to_integer(timestamp) ⇒ Integer
Converts an HL7 timestamp into an Integer
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/health-data-standards/util/hl7_helper.rb', line 9 def self.() if && .length >= 4 year = [0..3].to_i month = .length >= 6 ? [4..5].to_i : 1 day = .length >= 8 ? [6..7].to_i : 1 hour = .length >= 10 ? [8..9].to_i : 0 min = .length >= 12 ? [10..11].to_i : 0 sec = .length >= 14 ? [12..13].to_i : 0 Time.gm(year, month, day, hour, min, sec).to_i else nil end end |