Labs > Matlab: Convert between world time zones with DST

As I could find no built-in function nor reliable contribution to achieve that, I had no choice but to write my own, leveraging the GregorianCalendar Java class.
Usage is quite simple:

    targetDST = TimezoneConvert( dn, fromTimezone, toTimezone )

The datenum dn corresponds to the datetime you want to convert. Just specify from which timezone it comes and the target timezone, and you should get the expected result, that takes into account daylight saving time.

Feel free to let me know if I can extend it to support more situations (like Julian Calendar, obviously).

You can get the name of the available timezones using this command:


after importing the relevant java packages.

    import java.lang.String 
    import java.util.* java.awt.* 
    import java.util.Enumeration

The Financial Toolbox is required.

The package is downloadable here on Matlab Central.

Be the first to comment this post!

Leave a comment