web stats
Mirth Community - View Single Post - Convert date regardless of incoming pattern
View Single Post
Old 09-14-2018, 11:27 AM
OmarAQ OmarAQ is offline
What's HL7?
Join Date: Sep 2018
Posts: 3
OmarAQ is on a distinguished road
Default Convert date regardless of incoming pattern

Hi all;

I am new to Mirth with very little java script knowledge.

I am creating a channel to send an ORM to a PACS server in order to create a MWL, I managed to do so, but there is one problem, I cannot change the date format to: yyyyMMdd.

I searched the forums and found posts talking about this, using the DateUtil.convertDate, but the date I am getting after using it is incorrect (it changes the outcome to yyyyMMdd but not to the correct date).

I think that its because I receive date in multiple formats, mostly as dd-MMM-yy, sometimes as MM/dd/yyyy.

I found below method posted by naruply that changes the format regardless of the inbound message date/time to a specific pattern, no matter what pattern it comes in.


I am stuck here, as I really don`t know what to do with this code, I tried using it in the script section, but I always get: ReferenceError: "convertDate" is not defined.

Would you please help me in this issue.
Reply With Quote