web stats
Mirth Tools: User defined functions - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #13  
Old 02-21-2018, 08:37 PM
agermano agermano is offline
Mirth Guru
 
Join Date: Apr 2017
Location: Indiana, USA
Posts: 1,106
agermano is on a distinguished road
Default Format offset of current local time as string

I made a library because I needed to get a formatted datetime string for x number of days prior to now to use in a File Reader.

I put the following line in my channel deploy script to place the object in my globalChannelMap, but I suppose that it could also go in the global deploy script and globalMap, since each channel really doesn't need its own instance of it.
Code:
// Get object from code template that can be used to generate filenames with dates in the past.
$gc('mdu', MyDateUtil.getJavaObject());
Then for my Filename Filter Pattern I would use the following to get four days ago:
Code:
prefix_${mdu.formatCurrentDateTimeByOffset('yyyyMMdd', 'days', -4)}
It uses java 8 time functions and can do offsets in units from nanos to years.
Attached Files
File Type: xml MyDateUtil.xml (6.8 KB, 26 views)
Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 10:12 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Mirth Corporation