From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/37601 Path: news.gmane.org!not-for-mail From: Bart Wise Newsgroups: gmane.comp.tex.context Subject: Re: Datenumber Date: Thu, 29 Nov 2007 08:57:38 -0700 Message-ID: <200711290857.39040.bntgcontext@wiseguysweb.com> References: <200711270949.07518.bntgcontext@wiseguysweb.com> <6faad9f00711290335tebbb7e8kbddd5980b8d28add@mail.gmail.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1196351919 29972 80.91.229.12 (29 Nov 2007 15:58:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 29 Nov 2007 15:58:39 +0000 (UTC) To: "Mojca Miklavec" , ntg-context@ntg.nl Original-X-From: ntg-context-bounces@ntg.nl Thu Nov 29 16:58:45 2007 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by lo.gmane.org with esmtp (Exim 4.50) id 1Ixlmm-0001fU-II for gctc-ntg-context-518@m.gmane.org; Thu, 29 Nov 2007 16:58:44 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 2BCD41FB6B; Thu, 29 Nov 2007 16:58:00 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 08597-04; Thu, 29 Nov 2007 16:57:51 +0100 (CET) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id D98FE1FB4B; Thu, 29 Nov 2007 16:57:50 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 276EC1FB4B for ; Thu, 29 Nov 2007 16:57:49 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 08598-05-4 for ; Thu, 29 Nov 2007 16:57:44 +0100 (CET) Original-Received: from out02.mta.xmission.com (out02.mta.xmission.com [166.70.13.232]) by ronja.ntg.nl (Postfix) with ESMTP id BDE3C1FB43 for ; Thu, 29 Nov 2007 16:57:43 +0100 (CET) Original-Received: from [166.70.13.201] (helo=mgr1.xmission.com) by out02.mta.xmission.com with esmtp (Exim 4.62) (envelope-from ) id 1Ixlln-00039R-2h; Thu, 29 Nov 2007 08:57:43 -0700 Original-Received: from bwise1.provo.novell.com ([137.65.58.101] helo=bwise1) by mgr1.xmission.com with esmtpa (Exim 4.50) id 1Ixlll-0005Mo-5q; Thu, 29 Nov 2007 08:57:42 -0700 User-Agent: KMail/1.9.6 (enterprise 0.20070907.709405) In-Reply-To: <6faad9f00711290335tebbb7e8kbddd5980b8d28add@mail.gmail.com> Content-Disposition: inline Received-SPF: none (mgr1.xmission.com: 137.65.58.101 is neither permitted nor denied by domain of wiseguysweb.com) client-ip=137.65.58.101; envelope-from=bntgcontext@wiseguysweb.com; helo=bwise1; X-SA-Exim-Connect-IP: 137.65.58.101 X-SA-Exim-Mail-From: bntgcontext@wiseguysweb.com X-Spam-DCC: XMission; sa03 1397; Body=1 Fuz1=1 Fuz2=1 X-SA-Exim-Version: 4.2 (built Thu, 03 Mar 2005 10:44:12 +0100) X-SA-Exim-Scanned: Yes (on mgr1.xmission.com) X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.9 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:37601 Archived-At: 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 ___________________________________________________________________________________