Daily using/supporting

Get Firefox browser!
Get Thunderbird!
Get Opera browser!
Get The Gimp!
Get Inkscape!
Get LibreOffice!
Get Videolan!
Get Linux!
Get Mandriva!
Get Joomla!
Hacker Emblem

Archives

Which topics would you like us to cover more?

Latest comments

Latest tweets

about 1 day ago Using REDIPS.drag to add drag and drop to your .Net webapplication #li #dib0 http://t.co/n8zY3s7d
about 7 days ago http://t.co/cknQcDbo #Kindle
about 15 days ago Freedom isn't the ability to choose what to do or say, but the ability to choose what not to do or say #freedom
about 29 days ago http://t.co/61KTQknI #Kindle
12 Apr 2012 Force the use of a networking adapter using C# #li #dib0 http://t.co/ZTJOPzOz
9 Apr 2012 Mandriva 2010.2 and USB devices in Virtualbox http://t.co/fwq9gbHB
9 Apr 2012 Execute a http request to you own site with PHP http://t.co/DIvWPrpd
Home Architecture, security and coding How to parse the HL7 DateTime with nHapi
How to parse the HL7 DateTime with nHapi
Written by Division by Zero   
Tuesday, 30 August 2011 08:41

Recently someone asked me how to parse the DateTime form a HL7 message to a .Net DateTime. In may I wrote a post on how to read SIU messages. The last part was some code on how to parse this DateTime. Since it was quite a big post, this bit was quite hidden. So here's how to parse the HL7 DateTime.

I have copied the code from the earlier post (yes.. that's how lazy I am!).

TQ tq = message.SCH.GetAppointmentTimingQuantity().First();
TS startTime = tq.StartDateTime;
DateTime result = new DateTime(startTime.TimeOfAnEvent.Year, startTime.TimeOfAnEvent.Month, startTime.TimeOfAnEvent.Day, startTime.TimeOfAnEvent.Hour, startTime.TimeOfAnEvent.Minute, startTime.TimeOfAnEvent.Second);

In this code I interpret the TS data type within the TQ data type. There are a few data types concerning time.

Data Type Name Description

DR

Date/time range

Scheduling Only:

<range start date/time (TS)> ^ <range end date/time (TS)>

RI

Repeat interval

Scheduling Only:

<repeat pattern (IS)> ^ <explicit time interval (ST)>

SCV

Scheduling class value pair

Scheduling Only:

<parameter class (IS)> ^ <parameter value (IS)>

TQ

Timing/quantity

<quantity (CQ)> ^ <interval (*)> ^ <duration (*)> ^ <start date/time (TS)> ^ <end date/time (TS)> ^ <priority (ID)> ^ <condition (ST)> ^ <text (TX)> ^ <conjunction (ID)> ^ <order sequencing (*)>

 

Add comment


Security code
Refresh

A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools. - Douglas Adams


© 2009 - 2012, Division by Zero

Template based on the empire template by joomlashack 

Valid XHTML 1.0 Strict  Valid CSS!  Creative Commons License
This work by Division by Zero is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Netherlands License.