Background
Looking to include the current date, time, and timezone within a PDF.
Problem
The datetime
package does not provide a macro for the current timezone.
Question
How would you write a macro in LaTeX to create a date such as:
Sun Jan 09 20:17:18 EST 2011
Working
Thus far:
\usepackage{datetime}
\shortdayofweekname{\day}{\month}{\year}
\shortmonthname{} \twodigit{\day} \hhmmsstime{}
EST \number\year
The timezone (EST) eludes me.
Related
- http://blog.jansoehlke.com/?Recipes&nr=16
- http://mirror.ctan.org/macros/latex/contrib/datetime/datetime.pdf
Thank you!
Best Answer
You can get the offset from GMT using the pdfTeX primitive
\pdfcreationdate
: (no doubt LuaTeX has something similar)If you need to convert this into a timezone string, you'll need to define a dictionary of timezones to match up with the time offsets. Since I think this is a many-to-one mapping for many time zones, I'm not sure how that would work.
Once you work out exactly what you need for your application, I suggest writing to the
datetime
author to add such a feature to that package.Update. To get a crude lookup table for getting string output for the timezone, you can try something like this: