No announcement yet.

Date Formatting - Mirth 1.7.1

  • Filter
  • Time
  • Show
Clear All
new posts

  • Date Formatting - Mirth 1.7.1

    I just downloaded 1.7.1 and I am getting pretty far along in converting a pager alerter from another HL/7 engine. I can parse the data and generate the page. But I'm stuck on formatting the Admit Date/Time.

    I wish to go from the HL/7 Date/Time format to 'MM/DD/YYYY HH:MM.' I've spent quite a bit of time in the forum, but alot of the example are for previous versions. Without a reference guide, I'm having a hard time knowing how to code.

    Does anyone have a Date/Time convert routine they are willing to share for 1.7.1?


  • #2
    Reate Formatting - Mirth 1.7.1


    Try this:

    var datestring = DateUtil.convertDate(inpattern, outpattern, date);
    [li]inpattern: The current pattern of the date.[/li]
    [li]outpattern: The desired pattern for the date.[/li]
    [li]date: The current date string.[/li]

    For both in/out patterns, look at the documentation for SimpleDateFormat for guidance:

    Note that the sample code I provided above is available under the Date Functions section in the Reference tab for the transformers and filters.

    Hope this helps.

    Post edited by: geraldb, at: 05/02/2008 11:00
    Gerald Bortis | Chief Information Officer | Mirth Corporation


    • #3
      Reate Formatting - Mirth 1.7.1

      Thanks, that did the trick!

      Here is the code I am using to parse the Admit Date & Time.

      var msgdate = msg['PV1']['PV1.44']['PV1.44.1'].toString();
      var startdate = DateUtil.convertDate('yyyyMMddHHmmss.SSSSZ', 'MM/dd/yyyy', msgdate);
      var starttime = DateUtil.convertDate('yyyyMMddHHmmss.SSSSZ', 'HH:mm', msgdate);
      channelMap.put('admit_date', startdate);
      channelMap.put('admit_time', starttime);
      [Edit] Corrected format of date strings per HL/7 spec

      Post edited by: wseay, at: 05/07/2008 14:14