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

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

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