Converting HL7 TS or DT to System.DateTime
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > BizTalk Server > BizTalk Server > Converting HL7 TS or DT to System.DateTime




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Converting HL7 TS or DT to System.DateTime  
Tom


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
12-13-04 11:28 PM

I Posted this in the HL7 Group and have not gotten any reply. Please
pardon the repost:

I would like parse a HL7 TS and DT type to a System.DateTime
YYYY[MM[DD[HHMM[SS[.S[S[S[S]]]]]]]][+/-Z
ZZZ]

I am writing a .Net component to do this and I wanted to know if anyone
seen any C# code to do this?


I looked at the ParseExact and Parse Methods, and I don't see that it
has enough flexibility to do this.


For ParseExact, it seems that I will have to make an array of parsing
formats:


string[] l_strAParseList = {
"YYYYMMddHHmmss.ffffzzzz", "YYYYMMddHHmmss.ffffzzzz",
"YYYYMMddHHmmss.fffzzzz", "YYYYMMddHHmmss.fffzzzz",
"YYYYMMddHHmmss.ffzzzz", "YYYYMMddHHmmss.ffzzzz",
"YYYYMMddHHmmss.fzzzz", "YYYYMMddHHmmss.fzzzz",
"YYYYMMddHHmmsszzzz", "YYYYMMddHHmmsszzzz",
"YYYYMMddHHmmss.ffff", "YYYYMMddHHmmss.ffff",
"YYYYMMddHHmmss.fff", "YYYYMMddHHmmss.fff",
"YYYYMMddHHmmss.ff", "YYYYMMddHHmmss.ff",
"YYYYMMddHHmmss.f", "YYYYMMddHHmmss.f",
... }
and so on.

My next thought was to hand parse through the string:
if (HL7Date.Lenght > 8)


{
str l_strYYYY = HL7Date.Substring(0,4);
str l_strMM = HL7Date.SubString(4,2);
str l_strdd = HL7Date.SubString(6,2);
...
DateTime l_dtHL7Date = new DateTime(l_intHL7yyyy, l_intHL7MM,
l_intHL7DD, l_intHL7HH, l_intHL7Sec, ...);
}


Any suggestions would be appreciated.






[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 04:36 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register