Announcement

Collapse

Mirth Connect 4.3.0 Released!

Mirth Connect 4.3.0 is now available as an appliance update and on our GitHub page.

This is a major release containing new features like adding new functionality to the Mirth Connect Setup Wizard, adding the ability for resource and channel-specific classloaders to load child-first or parent-first, and added a default implementation of the getObjectsForSwaggerExamples() method in the ServicePlugin class. This release also contains enhancements for the Mirth Connect Administrator Launcher, the Mirth Connect Docker images, and several bug fixes and security improvements.

Download | See What's New | Upgrade Guide | Release Notes

For discussion on this release, see this thread.
See more
See less

how to modify date/time stamp?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • how to modify date/time stamp?

    Hi all,

    Using Mirth v1.5, I am trying to insert the current date/time into the MSH 7.1 segment via a JavaScript step in the source channel transformer. Am I headed in the right direction using something like this:

    var dateString = DateUtil.getCurrentDate(pattern);
    tmp['MSH']['MSH.7']['MSH.7.1'] = datestring;


    If so, then what is the format for "pattern" parameter for something like 20070729123955 ?
    Also, do I need a localMap.put statement at the end? Is it valid in v1.5?



    thanks,
    Paul

  • #2
    Re:how to modify date/time stamp?

    Paul,

    You are indeed going down the right direction. You can use the date format from here: http://java.sun.com/j2se/1.4.2/docs/...ateFormat.html

    Try this:

    Code:
    tmp['MSH']['MSH.7']['MSH.7.1'] = DateUtil.getCurrentDate("YYYYMMddhhmmss"«»);
    That would give you something like 20070729103045 for a date.

    You do not need to put anything in the localMap - it is not valid in 1.5 either (localMap is now channelMap)

    -Chris
    Chris Lang

    Comment


    • #3
      Re:how to modify date/time stamp?

      Chris,

      Thanks for the prompt reply !

      The JavaScript works fine now, although I had to modify the pattern parameter slightly to get it to not throw an error (this works):

      tmp['MSH']['MSH.7']['MSH.7.1'] = DateUtil.getCurrentDate("yyyyMMddHHmmss");

      Apparently the pattern parameter is case-sensitive and you have to enter the "y" and "M" and "d" exactly as specified in the SimpleDateFormat reference. I forgot about the strict case-sensitive Java rules :unsure:

      thanks again, man.

      Comment

      Working...
      X