ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Bart Wise <bntgcontext@wiseguysweb.com>
To: "Mojca Miklavec" <mojca.miklavec.lists@gmail.com>, ntg-context@ntg.nl
Subject: Re: Datenumber
Date: Thu, 29 Nov 2007 08:57:38 -0700	[thread overview]
Message-ID: <200711290857.39040.bntgcontext@wiseguysweb.com> (raw)
In-Reply-To: <6faad9f00711290335tebbb7e8kbddd5980b8d28add@mail.gmail.com>

On Thursday November 29 2007, Mojca Miklavec wrote:
> On Nov 27, 2007 5:49 PM, Bart Wise wrote:
> > LaTeX has a package called datenumber.  It basically allows you to
> > several things:
> >
> > 1) convert a date into a number,
>
> What number? What's the input and what's the output?

First you set the date:
\setdatenumber{year}{month}{day}
Example: \setdatenumber{2007}{1}{5}

Internally, this sets a counter called datenumber.
You print the date with \datedate.

Then, to increment by a week, you would add 7 to the datenumber and set the 
date as follows:  
\addtocounter{datenumber}{7}
\setdatebynumber{\thedatenumber}

I made a function that increments the date:
\def\IncDate{%
  \addtocounter{datenumber}{7}%
  \setdatebynumber{\thedatenumber}%
}%

Then, I created a table with the first column entries as follows:
\datedate\IncDate
\datedate\IncDate
\datedate\IncDate
\datedate\IncDate
\datedate\IncDate
...

The output would be:
Friday, 5 January, 2007
Friday, 12 January, 2007
Friday, 19 January, 2007
Friday, 26 January, 2007
Friday, 2 February, 2007

This way I do not have to put in anything except the first date and dates for 
the whole year are calculated and printed for me.

>
> > 2) add and subtract from that
> > number, in essence adding and subtracting days, and
> >
> > 3) converting a date number into a date string.
>
> The manual mentions this example
>     \date[d=17,m=11,y=2007][weekday,month,day,{, },year]
>
> or simply
>     \date[y=2007,m=11,d=27]
> or
>     \currentdate

As best as I can tell, this only sets the date.  I can see of no way to add a 
given number of days to calculate a new date.

>
> > I use this package to create a yearly lesson
> > schedule and various other similiar things.  However, I have spent a
> > considerable amount of time trying to find the same functionality in
> > ConTeXt with no avail. Is there a solution for this?
>
> There are quite some macros in tex/context/base/core-con.tex (&
> core-con.mkii) devoted to that. I didn't play with substraction yet,
> but I bet there is some simple way to do it.

I looked through the source code of core-con.mkii, core-con.mkiv and 
core-con.tex.  I don't see the functionality I need already constructed.  I 
was hoping that an existing solution existed without the need for creating 
new code.

>
> Mojca


Thanks for you help.  If I overlooked something, let me know.
Bart
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


      parent reply	other threads:[~2007-11-29 15:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-27 16:49 Datenumber Bart Wise
2007-11-28  4:29 ` Datenumber Aditya Mahajan
2007-11-28 16:34   ` Datenumber Bart C. Wise
2007-11-28 16:54   ` Datenumber Bart Wise
     [not found] ` <6faad9f00711290335tebbb7e8kbddd5980b8d28add@mail.gmail.com>
2007-11-29 15:57   ` Bart Wise [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200711290857.39040.bntgcontext@wiseguysweb.com \
    --to=bntgcontext@wiseguysweb.com \
    --cc=mojca.miklavec.lists@gmail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).