Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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!

share|improve this question
    
Why do you need the to-day's time after two days? The string you also printing is very non-standard see en.wikipedia.org/wiki/Coordinated_Universal_Time. For what you are after two packages are an overkill! –  Yiannis Lazarides Jan 11 '11 at 3:02
    
@Yiannis: The string I am printing is the default output format for a Java string; I am looking to emulate it in LaTeX so that I can show the reader what output to expect. I cannot change the format without customizing all the Java Virtual Machines in the world (or change my example). ;-) –  Dave Jarvis Jan 11 '11 at 4:01
    
@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. –  Yiannis Lazarides Jan 12 '11 at 1:00

1 Answer 1

up vote 1 down vote accepted

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.
share|improve this answer
    
When I reverse them, I get a cryptic error, You can't use 'the character 7' after \advance. –  Dave Jarvis Jan 11 '11 at 1:31
    
@Dave Jarvis It does appear that there is a conflict, but my minimal above works! I always check them before posting. –  Yiannis Lazarides Jan 11 '11 at 1:34
    
Does it work if you use the preamble I've shown? (I can get the simple case working alright, but when I try to get the day name two days hence, it fails.) –  Dave Jarvis Jan 11 '11 at 1:37
    
@Dave Jarvis - see edit above. –  Yiannis Lazarides Jan 11 '11 at 1:48
    
I have clarified the problem a bit more. –  Dave Jarvis Jan 11 '11 at 2:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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