After your next 'svn update', please run 'make pyicu' or 'make install'.

Then you should be able to store time zones into the repository (in addition to already being able to store datetime and time instances with a time zone).

Time zone objects supported by the repository are instances of PyICU.ICUtzinfo, a subclass of Python's datetime.tzinfo class that wraps an ICU TimeZone instance. Such an object can of course be used with Python's datetime and time objects.

To obtain an ICUtzinfo instance:

  >>> from PyICU import ICUtzinfo
  >>> tz = ICUtzinfo.getInstance(name)

where name is one of the 577 names supported by the ICU library.
To list these names:
  >>> from PyICU import TimeZone
  >>> list(TimeZone.createEnumeration())

To express 'now' in Sao Paulo, Brazil:

  >>> from PyICU import ICUtzinfo
  >>> from datetime import datetime
  >>> now = datetime.now(tz=ICUtzinfo.getInstance('America/Sao_Paulo'))

Andi..
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Open Source Applications Foundation "Dev" mailing list
http://lists.osafoundation.org/mailman/listinfo/dev

Reply via email to