I want to change the timezone format (say, I want to use always GMT-3 timezone). I am using the datetime2 package. Do I need to use the following command as mentioned in the manual?


  • Did you try this command out? Does it give the intended result? Or an error? Why do you think this command may or may not do what you want? Please clarify.
    – Marijn
    Feb 22 at 12:16
  • @marijn I actually don't know how to use this command. Could you please help me?
    – PoreyS
    Feb 22 at 12:23
  • We can probably demonstrate the commands you need (or point you to other questions where they are used) but currently it is not really clear for me what you actually want to do. Could you explain (approximately) which input you want to provide in your document and which output you expect from that?
    – Marijn
    Feb 22 at 14:03
  • Whenever I use the command '\DTMnow' and compile, the time it shows, changes if I travel from one time zone to another. I want to fix the timezone so that, even if I shall visit, the time of the last compilation will be shown in the specified timezone (say CEST).
    – PoreyS
    Feb 22 at 17:33

1 Answer 1


The datetime2 package has a library for performing calculations on times and dates which can be loaded with \usepackage[calc]{datetime2}. This library provides two functions to convert from and to Zulu time (UTC+0). With these functions you can do a three-step approach: first convert the local time to Zulu time, second convert the Zulu time to the timezone you want to show, and third actually show the result of step two in the requested timezone.

In the MWE below I defined two new commands, one for converting to arbitrary time zones with two arguments for the offset and the reverse offset, and one shortcut command with the arguments pre-filled for Central European Summer Time (which is a bit odd since it is not summer at the moment, but in any case it is UTC+2, so Finland, the Baltics, most of the Balkan countries, some Middle Eastern countries, Egypt, Libya).



% store current time in object 'now'
% convert current time to UTC+0
% add requested timezone offset to zulu time
% display zulu+offset in requested timezone (= reverse offset)
% shortcut command for central european summer time (UTC+2)

in current timezone: \DTMnow

in CEST: \DTMcestnow


enter image description here

  • Thanks. It is working for me. [en-MT] part is just for styling, right? The code runs well without those two lines. Two questions - Why is there {+02} in \newcommand{\DTMcestnow}{\DTMtznow{+02}{-02}}? And how should I change this line if the difference between those two time zones is 2 hours and 30 minutes?
    – PoreyS
    Feb 24 at 2:07
  • 1
    @PoreyS indeed en-MT is just for styling. The +02 and -02 are because you need to subtract to store the time in the requested timezone as UTC+0, and then provide the reverse timezone parameter to show the calculated UTC+0 time in the requested timezone again. It's a bit of a roundabout way, the datetime2 package is much more aimed at formatting dates and times than at calculating. For 30 minutes difference you should extend the command to accept two extra arguments #3 and #4 and use them instead of the two 00 values (right after the current #1 and #2).
    – Marijn
    Feb 24 at 6:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.