Class Name: HL7DateConverter
Scope: Public - Unrestricted
Factory Creation: Yes - SQLSchemaAPIKey.HL7Date() methods
The HL7DateConverter object is a free utility object you can use to create HL7 compatible datetime stamps which will include pesky little things like the timezone offset etc. You can also use it to convert HL7 datetime Strings values into a Date.
Try Dim x As New HL7DateConverter 'with no parameters passed it will be set to Now() Dim s As String = x.HL7Value(HL7DateConverter.HL7DateTimePrecision.enMilliseconds) MessageBox.Show(s, "TimeStamp to the Second") Dim newDt As Date = System.DateTime.Now.AddYears(-50) 'I can pass a date as well and get the result s = x.HL7Value(newDt, HL7DateConverter.HL7DateTimePrecision.enDay) MessageBox.Show(s, "50 Years Ago") 'Or I can create the object using a date value for 'the exact same result. x = New HL7DateConverter(newDt) s = x.HL7Value(HL7DateConverter.HL7DateTimePrecision.enDay) MessageBox.Show(s, "50 Years Ago") 'Convert a HL7 String to a Date x = New HL7DateConverter(s) If Not x.IsValid Then MessageBox.Show(s & " is Not a valid date") Else Dim dt1 As Date = x.Datevalue MessageBox.Show(dt1.ToLongDateString, "Converted From String") End If 'Create an Error s = "A Bad Value" x = New HL7DateConverter(s) If Not x.IsValid Then MessageBox.Show(s & " is Not a valid date") Else Dim dt1 As Date = x.Datevalue MessageBox.Show(dt1.ToLongDateString, "Converted From String") End If
Catch ex As Exception 'Handle the exception End Try
|
|
READ-ONLY Properties
DateValue - Date. The current date value of the object (can be Nothing if IsValid is False) IsValid - Boolean. Does the object contain a valid DateValue. HL7TimeZoneOffset - String. The String suffix on a HL7 formatted timestamp.
|
|
•Description: Returns a HL7 formatted date or datetime string using the current DateValue property. •Parameter 1 (Optional): A HL7DateTimePrecision Enum value indicating what precision you want (Day, Minutes, Seconds etc).
•Description: Returns a HL7 formatted date or datetime string. •Parameter 1: Date. The Date value you wish to convert to a HL7 string value •Parameter 2 (Optional): A HL7DateTimePrecision Enum value indicating what precision you want returned (Day, Minutes, Seconds etc).
|