web stats
Mirth Community - View Single Post - Mirth Tools: User defined functions
View Single Post
Old 04-17-2012, 11:20 AM
upstart33 upstart33 is offline
Mirth Guru
Join Date: Dec 2010
Location: Chicago, IL.
Posts: 461
upstart33 is on a distinguished road

5: Local Timzones
Purpose: Sometimes, your not running Mirth locally and you need the correct timezone.

function getCurrentLocalTimestamp() {
   var formatter = new Packages.java.text.SimpleDateFormat("yyyyMMddhhmmss"); 
   // your local TZ
   return formatter.format(new Packages.java.util.Date()); 
The function can be used to get the local server date/time by the following:
tmp['MSH']['MSH.7']['MSH.7.1'] = getCurrentLocalTimestamp();
Reply With Quote