I'm using ShareLaTeX, which, for those who don't know, is a website that compiles LaTeX on a server. The issue is that when I type \today, it gives my the date of the server. So, for example, right now it is 10:00 PM EST on October 8 and it gives me October 9, 2013. Is there any way I can force EST? preferably for the entire document.


For me, EST (UTC−05) and EDT (UTC−06) is nearly always six hours behind my timezone.

Using the datetime package which provides a few counts for formatting and printing timestamps, we can simply test if the current hour (the server’s) is lower than 6 and if subtract 1 from the day. Of course, you will also need to test whether it is currently the first day of the month and need to consider leap years.

Of course, you can always just set a specific \today:

\def\today{It's always today.}

The datetime package offers much more options to format dates and such.


\currenttime, \today

    \ifnum\month=1 \month13\advance\year-1\fi
    \day\ifcase\month\or31\or\ifDTleapyear 29\else 28\fi\or31\or30\or31\or30\or31\or

\currenttime, \today


04:52, Wednesday 9th October, 2013
22:52, Tuesday 8th October, 2013


You can do a bit of monkeying about with the definition of \today. Here's the start of something:

It let's you just set the time difference in hour between EST and the remote server's time. (This will not work properly for Feb 28, 29 or March 1 in a leap year!)

This works by looking at \time and computing the difference between LaTeX's internal \time value (in minutes from midnight) and your local time (EST). Based upon that difference you either need to advance a day, stay on the same day, or go back a day. This may have to trigger other changes such as the month and or year.

%% save time/day/month

%% personalized version of `\today`
     %% Go Back a day:     
      %% Go Forward a day: 
    %% It's just today:

%% Code to set the day back by one                                      
%% If it's the first of the month, then you need to also                
%% set the month back a day.  If it's January and the first of the month
%% you'll need to set the year back.                                    
      %% no month "0"
      \day=31\relax\or%%<-- Jan   
      \day=28\relax\or%%<-- Feb   
      \day=31\relax\or%%<-- March 
      \day=30\relax\or%%<-- April 
      \day=31\relax\or%%<-- May   
      \day=30\relax\or%%<-- Jun   
      \day=31\relax\or%%<-- July  
      \day=31\relax\or%%<-- Aug   
      \day=30\relax\or%%<-- Sept  
      \day=31\relax\or%%<-- Oct   
      \day=30\relax\or%%<-- Nov   
      \day=31\relax%%%%%<-- Dec   

%% Code to set the day forward by one                               
%% You need to test whether it is the last day of the month.        
%% If it's the last day of the month, you need to advance the month.
%% If it's December and the last day of the month, you need to      
%% advance the year.                                                
    \edef\test@day{31}\or%%<-- Jan                    
    \edef\test@day{28}\or%%<-- Feb                    
    \edef\test@day{31}\or%%<-- March                  
    \edef\test@day{30}\or%%<-- April                  
    \edef\test@day{31}\or%%<-- May                    
    \edef\test@day{30}\or%%<-- Jun                    
    \edef\test@day{31}\or%%<-- July                   
    \edef\test@day{31}\or%%<-- Aug                    
    \edef\test@day{30}\or%%<-- Sept                   
    \edef\test@day{31}\or%%<-- Oct                    
    \edef\test@day{30}\or%%<-- Nov                    
    \edef\test@day{31}%%%%%<-- Dec                    

%% Code for setting up the hour difference between EST and the time the remote
%% computer is using.  Set this by "hours".                                   
%% Just testing at various month/year boundaries:
%% setting up the time difference

Getting today:  \mytoday


This works rather crudely. It currently doesn't get leap years correct. But it should show you something about what you can do.

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.