emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Charles Cave <charles_cave@optusnet.com.au>
To: emacs-orgmode@gnu.org
Subject: Python script to generate a daily diary/journal
Date: Fri, 26 Jun 2009 03:32:37 +0000 (UTC)	[thread overview]
Message-ID: <loom.20090626T032106-348@post.gmane.org> (raw)

I wanted to create the equivalent of a yearly diary with
space for recording notes on each day. I used to use 
paper diaries with the week number and day number written
on each page.

I already have a system using Remember to record notes with 
date/time stamps but this script generates a file with a 
specific structure. 

First of all, here is part of the output

* July 2009 
** Wed [2009-07-01 Wed]
Week 27 - Day 182
** Thu [2009-07-02 Thu]
Week 27 - Day 183
** Fri [2009-07-03 Fri]
Week 27 - Day 184
** Sat [2009-07-04 Sat]
Week 27 - Day 185
** Sun [2009-07-05 Sun]
Week 27 - Day 186
** Week 28 - Mon [2009-07-06 Mon]
Week 28 - Day 187

Some useful features of this format:

1. Clicking on a date takes you to the agenda for that day

2. You can search for a particular day number, 
   namely search for "Day 150"

3. You can search for a particular week,
   namely search for "Week 23"

4. The outline can be collapsed to a month. This allows
   included monthly notes under the month headline.

5. Each month shows all the days of the month and each week
   stands out because the headline is deliberately longer.



Here is the script. Run the script and capture the output
in a file, eg diary2009.org


import datetime
# datetime documented at http://docs.python.org/library/datetime.html
# Set yor diary start date on the line below
theday = datetime.date(2009, 1, 1)   
 
for  i in range(0, 380):
    iso_info = theday.isocalendar()
    weektag = ""
    if theday.day == 1:
        print "* %s %d " % (theday.strftime("%B"), theday.year)
    if theday.weekday() == 0:
        weektag = "Week %2d - " % iso_info[1]
        
    print "** %s%-3s [%04d-%02d-%02d %3s]" % (weektag, theday.strftime("%a"),
theday.year, theday.month,
                                              theday.day, theday.strftime("%a"))
    print "Week %s - Day %s" % (iso_info[1], theday.strftime("%j"))
    theday = theday + datetime.timedelta(days = 1)
    

                 reply	other threads:[~2009-06-26  3:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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

  List information: https://www.orgmode.org/

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

  git send-email \
    --in-reply-to=loom.20090626T032106-348@post.gmane.org \
    --to=charles_cave@optusnet.com.au \
    --cc=emacs-orgmode@gnu.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).