Mirth Connect 3.12.0 Released!

Mirth Connect 3.12.0 is now available as an appliance update and on our GitHub page. This release includes database performance improvements, improves visual HL7 representation, message pruning, keystore handling, PDF generation, community contributions, and fixes several security vulnerabilities. This release also contains many improvements to commercial extensions. See the release notes for the list of fixes and updates.

Download | See What's New | Upgrade Guide | Release Notes

For discussion on this release, see this thread.
See more
See less

Summer/Winter time changeover problem

  • Filter
  • Time
  • Show
Clear All
new posts

  • Summer/Winter time changeover problem

    Hello all,

    I have created the following function in Mirth, that gets the current time and converts it in UTC:

    //This function calculates the current time and converts it into UTC
    function calcDateTimeUTC () {
    	var now = new Date();
    	var year=now.getFullYear();
    	var month=now.getMonth();
    	var day=now.getDate();
    	var hours=now.getHours();
    	hours = hours-1; //Difference current time <--> UTC
    	var minutes=now.getMinutes();
    	var seconds=now.getSeconds();
    	//Current time --> UTC.	
    	return Date.UTC(year, month, day, hours, minutes, seconds);	
    The problem is that it works correctly only in the winter time. In summer time I should substract -2 on the row "hours = hours-1;".
    Do you know how to determine if the time now is wintertime or summertime?

    Thank you!


    Post edited by: Svetlomir Kasabov, at: 09/18/2008 05:47

  • #2
    Re:Summer/Winter time changeover problem

    You might try using the Java time libraries, they should either let you specify a time zone or pick up the time zone from the machine environment.
    Jon Bartels

    Zen is hiring!!!!
    Talented healthcare IT professionals wanted. Engineers to sales to management.
    Good benefits, great working environment, genuinely interesting work.


    • #3
      Re:Summer/Winter time changeover problem

      Thanks for the reply jbartels,

      the javascript code

       hours = hours - ((now.getTimezoneOffset())/60);
      did the job.

      But your idea about determining the time zone helped me a lot!



      Post edited by: Svetlomir Kasabov, at: 09/18/2008 06:59