Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
Expertise Level:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)

This page was last modified 20:13, 14 October 2007.

How to use calendar

From Forum Nokia Wiki

Python provides calendar module where you can manipulate your calendar and todo items. Many item types (called entry) are contained in the calendar :

  • Appointment
  • Event
  • Anniversary
  • Todo

There is also a TodoList type to group each TodoEntry into many lists.

Here is shown some simple tasks.

import time, calendar
now = time.time()
cal = calendar.open()
 
day_all = cal.daily_instances(now) # all entries today
# if you specify any of the 4 types, it will show only those
month_ev = cal.monthly_instances(now, events=1) # events this month
# search for keyword within duration
jan01 = mktime((2005,1,1, 0,0,0, 0,0,0))
first_km = cal.find_instances(jan01, now, u'km')[0] # first in this year
 
# display entry information
e = cal[first_km['id']] # or use any entry found above
print e.type, strftime('%b %d %H:%M', localtime(e.start_time))
print e.content, '(', e.location, ')'
# other properties are id, last_modified, priority, alarm,
#  replication, crossed_out, and end_time
 
# add new appointment
a = cal.add_appointment()
a.content = 'urgent meeting'
a.set_time(now, now) # start and end time
a.commit()
Related Discussions
Thread Thread Starter Forum Replies Last Post
wakeup on calendar events yogi-am Python 1 2007-11-23 07:12
calendar vijayasreesv General Symbian C++ 2 2005-02-24 14:26
S603d device: timezone issue in calendar app blizzz General Symbian C++ 25 2006-09-07 07:10
Access Phone Book or Calendar with the API ? sebnunes Mobile Java Tools & SDKs 4 2004-10-13 08:29
N90 - missing Duplicate command in Calendar? lkraav General Discussion 2 2006-04-17 03:41
 
Powered by MediaWiki