Latest news 2021-09-06: new blog post "Legacy Documents and TeX Live Docker Images".

Bug Tracker

ID 95🔗
Date: 2015-09-14 11:36:21
Status Closed (Fixed)
Category datetime2
Version 1.0
Summary \DTMsaveaszulutime calculates the wrong UTC time

Sign in to subscribe to notifications about this report.

Description

The \DTMsaveaszulutime command appears to calculate the UTC time incorrectly. The example in the manual illustrates this:
Original date: 2014-05-01 03:55:00-06:00.
UTC+00:00: 2014-04-30 21:55:00Z.

The original date is in the timezone UTC-6, so the corresponding UTC time should be 09:55:00, not 21:55 the previous day.

If I save and print the current time using:

\DTMsavenow{creationDate}
\DTMtozulu{creationDate}{creationDateUTC}
\DTMuse{creationDateUTC}
I am given a UTC time of 18:20. My local time is 17:20 BST (= UTC+1), so the corresponding UTC time should be 16:20, not 18:20. (The minimal working example will only show the improper behaviour if the computer's timezone is not set to UTC.)

As far as I can tell, this can be fixed by changing the line

\edef\@dtm@TZhour{\number#8}%
to
\edef\@dtm@TZhour{-\number#8}%
in the package's source code.

MWE

Download (230B)

\documentclass{article}
\usepackage[calc]{datetime2}

\begin{document}

\DTMsavenow{creationDate}
\DTMtozulu{creationDate}{creationDateUTC}

Current time: \DTMuse{creationDate}

UTC time: \DTMuse{creationDateUTC}


\end{document}

Evaluation

Fixed in v1.1 2015-09-15.

Comments

0 comments.


Add Comment

Name (optional):

Are you human? Please confirm the bug report ID (which can be found at the top of this page) or login if you have an account.

Comment:

You can use the following markup:

Block:

[pre]Displayed verbatim[/pre]
[quote]block quote[/quote]

In line:

[tt]code[/tt]
[file]file/package/class name[/file]
[em]emphasized text[/em]
[b]bold text[/b]
[url]web address[/url] [sup]superscript[/sup]
[sub]subscript[/sub]

Ordered list:
[ol]
[li]first item[/li]
[li]second item[/li]
[/ol]

Unordered list:
[ul]
[li]first item[/li]
[li]second item[/li]
[/ul]

You can use the Preview button to review your message formatting before submitting.

Page permalink: https://www.dickimaw-books.com/bugtracker.php?key=95