Categories: S60 | Python | How To | Code Examples
This page was last modified 19:36, 24 April 2008.
How to get current date and time
From Forum Nokia Wiki
This article describes some ways to get current date and time using Python
#import time module >>> import time >>> time.localtime() #The localtime function returns the following tuple (2008, 4, 24, 14, 36, 8, 3, 115, 0) >>> time.localtime()[0] #Returns the current year 2008 >>> time.localtime()[1] #Returns the current month 4 >>> time.localtime()[2] #Returns the current date 24 >>> time.localtime()[3] #Returns the current time - hour 14 >>> time.localtime()[4] #Returns the current time - minutes 36 >>> time.localtime()[5] #Returns the current time - seconds 3 >>> time.time() #Returns seconds elapsed since 1/1/1970 00:00:00 1209040719.4159999 ################################# #Other method using for loop start = time.clock() for x in range(1000000): y = x # do something end = time.clock() print "Time elapsed = ", end - start, "seconds"
There is a module datetime,which has been adapted to Python S60 so you can use it and install it as lib.
Here is a link to the related article which mentions how to handle date and time.
| Related Discussions | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| calendar date problem in j2me.. | egc_33 | Mobile Java General | 1 | 2007-04-02 23:20 |
| code to get a time or a date... | remy_vrs | Mobile Java General | 4 | 2006-07-08 20:45 |
| Signing a Application (I got a CA Root Cert) | lpinguin | Mobile Java General | 7 | 2007-12-20 15:12 |
| About Fisrt Delivery time | aminimesk | General Messaging | 1 | 2003-04-11 13:14 |
| 电话本疑问? | meiscai | Symbian | 4 | 2008-05-04 11:20 |
