| Reply | « Previous Thread | Next Thread » |
|
Hi
I am new to Python. I have v1.4.5 installed on my handset and I wish to do some data/time calculations. Is there an obhect I can use to store a data/time and add or substract a number of days to/from it? REgards Patrick |
|
Join Date: Oct 2007
Posts: 2,845
Location: Deva, Romania
Online
Forum Nokia Champion
|
|
Hi,
Well, you should check out the time module. It has all sorts of functions that can help. The documentation is here. If you're willing to use PyS60 1.9.5 or later you can also use the datetime module. |
|
Hi
TYhanks for your reply. What if I was to do the following, would I get todays date + 10 days? time.gettime() + 10 How about having a tine representing 25/12/2009, would the following work? time.mktime(time.struct_time(tm_year=2009, tm_mon=12, tm_mday=25, tm_hour=0, tm_min=0, tm_sec=0, tm_isdst=-1)) Regards Patrick |
|
Join Date: Oct 2007
Posts: 2,845
Location: Deva, Romania
Online
Forum Nokia Champion
|
||
|
Quote:
Code:
time.time() + 10*86400 Quote:
If it doesn't, post your problem here and we'll try to help. |
|
I have tried constructing a struct_time "object" called base in the following way.
base.tm_year = 2009 base.tm_mon = 3 base.tm_mday = 1 base.tm_hour = 0 base.tm_min = 0 base.tm_sec = 0 base.tm_isdst = -1 When I try to run this, the interpreter tells me that "base" is undefined. How do I tell the interpreter that "base" is a struct_time "object"? |
|
Join Date: Oct 2007
Posts: 2,845
Location: Deva, Romania
Online
Forum Nokia Champion
|
|
struct_time the type of the tuples returned by functions like localtime(). Anyway, you can create s struct_time object from a sequence by calling the struct_time function on that sequence:
Code:
example = [2009, 6, 25, 10, 30, 43, 3, 176, 1] base = time.struct_time(example) |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Rate This Thread | |
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| RFileLogger Date/Time Format | tsdgeos | General Symbian C++ | 1 | 2009-03-11 05:59 |
| is it possible to acquire date/time from built in GPS? | kavehmb2000 | Mobile Java General | 9 | 2009-03-10 06:13 |
| getting the file date/time irrespective of sytem date | himsymbian | General Symbian C++ | 9 | 2009-02-13 12:57 |
| Is it possible to check App's modification date/time without AllFiles capability. | jvinjam | General Symbian C++ | 3 | 2009-01-27 09:24 |
| PC Suite date/time problem | dohanin | General Discussion | 1 | 2006-01-25 12:33 |