3

Background

Trying to include a date two days in the future from when the content was generated.

Problem

The following results in an empty day name:

\usepackage{datetime}
\usepackage{datenumber}
% ...
\shortdayofweekname{\day}{\month}{\year}

The following works as expected:

\usepackage{datetime}
% ...
\shortdayofweekname{\day}{\month}{\year}

Would like to do the following:

\usepackage{datetime}
\usepackage{datenumber}
% Preamble
\setdatetoday
\addtocounter{datenumber}{2}%
\setdatebynumber{\thedatenumber}%
% Document...
\shortdayofweekname{\thedateday}{\thedatemonth}{\thedateyear}

It looks like there is a package conflict.

Desired Output

For example, if today was January 10, 2011, then the result should read:

Wed Jan 12 18:03:02 EST 2011

Question

I have emailed the datetime package author; what else can be done to resolve the problem?

Thank you!

Dave Jarvis
  • 11,809
  • Why do you need the to-day's time after two days? The string you also printing is very non-standard see http://en.wikipedia.org/wiki/Coordinated_Universal_Time. For what you are after two packages are an overkill! – yannisl Jan 11 '11 at 03:02
  • @Yiannis: How is that nonstandard? It's exactly the format produced by the standard date command. The man page tells me that "[t]he date utility is expected to be compatible with IEEE Std 1003.2 ('POSIX.2')." – TH. Jan 11 '11 at 10:22
  • @TH Best source for datetime is the pdfcreation stamp. This is based on UTC. UTC does not define TimeZone strings such as EST, as they are confusing for example EST is both European Summer Time, the daylight-saving time used in Europe and the US Eastern Standard Time. There are also problems for some countries like Russia having 9 different time zones. The IEEE Std (much older than the ISO ones does allow). You can imagine you are an ISP sorting emails and you can see the difficulties. – yannisl Jan 12 '11 at 01:00

1 Answers1

2

This is my normal header for dates and it works for both, as well as the Koma script date and time classes.

\documentclass{article}
\usepackage{datenumber,datetime,scrdate,scrtime} %time related macros

\usepackage[polutonikogreek, german, greek, 
    french, english]{babel}[2005/11/23]
\begin{document}
%% From datetime
\shortdayofweekname{\day}{\month}{\year}
%% From datenumber
\datedayname
\end{document} 

Just reverse the packages. With datetime you also need to watch that it is loaded before babel.

Create new counters and a command for daydiff

\newcounter{dateone}%
\newcounter{datetwo}%
\newcommand{\daydifftoday}[3]{%
  \setmydatenumber{dateone}{\the\year}{\the\month}{\the\day}%
  \setmydatenumber{datetwo}{#1}{#2}{#3}%
  \addtocounter{datetwo}{-\thedateone}%
  \thedatetwo}

There are still \daydifftoday{\the\year}{12}{25} days to Christmas.
yannisl
  • 117,160
  • @Dave Jarvis It does appear that there is a conflict, but my minimal above works! I always check them before posting. – yannisl Jan 11 '11 at 01:34