Date formatter using DateUtil in Mirth

Converting a date from one format to other in Mirth.

function getDateFromUnixTimeStamp(timeStamp){
var t = new java.util.Date(timeStamp*1000);
var dateFromUnixTimeStamp = DateUtil.convertDate("EEE MMM dd HH:mm:ss zzz yyyy", "yyyy-MM-dd hh:mm:ss", t);
return dateFromUnixTimeStamp;

4 comments on “Date formatter using DateUtil in Mirth

  1. Anonymous says:

    hi, how to convert DateTime to unix time stamp?

    • schoolhood says:

      Use the method getTime here. Just for a precaution, this works only on Date object. Hence follow these steps:-
      var myDate = DateUtil.getDate(“yyyy-MM-dd”, “2013-10-26”);
      var unixDt = myDate.getTime()/1000;
      channelMap.put(“Unixdate”, unixDt);

  2. Roosevelt says:

    It’s hard to find your posts in google. I found it on 17 spot, you should build quality backlinks
    , it will help you to increase traffic. I know how to help you, just type in google – k2 seo tips and tricks

  3. Christal says:

    I read a lot of interesting content here. Probably you spend a
    lot of time writing, i know how to save you a lot of time, there
    is an online tool that creates unique, SEO friendly articles in minutes,
    just type in google – laranitas free content source

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s