×
Namespaces

Variants
Actions
Revision as of 07:05, 12 January 2012 by hamishwillee (Talk | contribs)

Archived:How to easy handle date and time

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Article
Created: cyke64 (29 Mar 2007)
Last edited: hamishwillee (12 Jan 2012)

Python doesn't have a decent date/time class. There's a small compatible library from the Python Web Project : datetime. It has been adapted to Python S60 so you can use it and install it as lib.

Here's an example use in command line

import datetime
>>> day = datetime.datetime(2003, 8, 4, 12, 30, 45)
>>> print day
2003-08-04 12:30:45
>>> print repr(day)
datetime.datetime(2003,8,4,12,30,45)
>>> print type(day)
<type 'instance'>
>>> print day.year, day.month, day.day
2003 8 4
>>> print day.hour, day.minute, day.second
12 30 45
>>> print datetime.datetime.now()

link : datetime for Python

44 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×