You Are Here:

Community: Developer Discussion Boards

#1 Old Date problem in python - 2008-08-18, 23:22

Join Date: Aug 2005
Posts: 1,736
Location: india
Send a message via ICQ to mateen_maldar Send a message via Skype™ to mateen_maldar
mateen_maldar's Avatar
mateen_maldar
Offline
Forum Nokia Champion
Hi,

This is my second post on python, well i tried to use the date .. like this..

import appuifw

appuifw.query(u"Type a date:", "date", u"01/01/2008")

Everytime i run it must display 01/01/2008 inside the dialog instead it displayes 01/01/1970, on emulator i tested this..

Does anyone know why this is behaving like that...

i'm using S60_3rded_Fp2 ...

i just was trying to learn python...

Regards,
Mateen Maldar


"Whatever the mind can conceive and believe, the mind can achieve"
"Of course there is no formula for success except perhaps an unconditional acceptance of life and what it brings"
Last edited by mateen_maldar : 2008-08-19 at 12:42. Reason: Forgot that i posted on python already
Reply With Quote

#2 Old Thumbs up Re: Date problem in python - 2008-08-19, 00:40

Join Date: May 2007
Posts: 2,737
Location: 21.46 N 72.11 E
croozeus's Avatar
croozeus
Offline
Forum Nokia Champion
Hi Mateen,

Quote:
Originally Posted by mateen_maldar View Post
Hi,

This is my first post on python,
I don't think so this is your first post on Python Forum

want to build python src

Quote:
Originally Posted by mateen_maldar View Post
well i tried to use the date .. like this..

import appuifw

appuifw.query(u"Type a date:", "date", u"01/01/2008")

Everytime i run it must display 01/01/2008 inside the dialog instead it displayes 01/01/1970, on emulator i tested this..

Does anyone know why this is behaving like that...

i'm using S60_3rded_Fp2 ...
From the PyS60 documentation :

Date and Time
:
Unix time, seconds since January 1, 1970, 00:00:00 UTC (Coordinated Universal Time), is generally used
as the time format in the Python for Series 60 APIs described in this document.

So it doesn't matter if you write,
Code:
appuifw.query(u"Type a date:", "date", u"01/01/2008") 
or 
appuifw.query(u"Type a date:", "date", u"Mateen")
Date will always start from January 1, 1970.

And for time it doesn't matter if you write the following,

Code:
appuifw.query(u"Type time:", "time", u"09:00") 
or
appuifw.query(u"Type time:", "time", u"01/01/2008") 
or 
appuifw.query(u"Type Time:", "time", u"Mateen")
Time will always start from 00:00:00 UTC.
Quote:
Originally Posted by mateen_maldar View Post
i just was trying to learn python...
Great to have one more FNC interested in PyS60

Best Regards,
Croozeus
Reply With Quote

#3 Old Re: Date problem in python - 2008-08-19, 06:59

Join Date: Feb 2008
Posts: 2,542
Location: Bhavnagar, Gujarat, India
Send a message via Yahoo to gaba88 Send a message via Skype™ to gaba88
gaba88's Avatar
gaba88
Offline
Forum Nokia Champion
hi mateen
great to see you in the python discussion boards


Gargi Das- http://gargidas.blogsot.com

Forum Nokia Python Wiki


Learn Python at http://mobapps.org/PyS60
Reply With Quote

#4 Old Re: Date problem in python - 2008-08-19, 14:41

Join Date: Aug 2005
Posts: 1,736
Location: india
Send a message via ICQ to mateen_maldar Send a message via Skype™ to mateen_maldar
mateen_maldar's Avatar
mateen_maldar
Offline
Forum Nokia Champion
Hi,

I will answer myself again asusual, as i'm not satisfied with the below explanation..

This is the exact reason for this behaviour.
Quote:
There are two standard representations of time. One is the number\n\
of seconds since the Epoch, in UTC (a.k.a. GMT). It may be an integer\n\
or a floating point number (to represent fractions of seconds).\n\
The Epoch is system-defined; on Unix, it is generally January 1st, 1970.\n\
The actual value can be retrieved by calling gmtime(0).\n\
I Hope someone has more explanation about this...any Pointers are appriciated

Regards,
Mateen Maldar


"Whatever the mind can conceive and believe, the mind can achieve"
"Of course there is no formula for success except perhaps an unconditional acceptance of life and what it brings"
Last edited by mateen_maldar : 2008-08-19 at 14:41. Reason: typo
Reply With Quote

#5 Old Re: Date problem in python - 2008-08-19, 15:14

Join Date: Dec 2007
Posts: 409
Location: Tempe, AZ
Send a message via Yahoo to shubhendra Send a message via Skype™ to shubhendra
shubhendra's Avatar
shubhendra
Offline
Forum Nokia Champion
I think thats due to implementation, as done in appuifwmodule.cpp where implementation is like this,

Code:
case R_APPUIFW_DATE_QUERY:

case R_APPUIFW_TIME_QUERY:

  time = (rid == R_APPUIFW_DATE_QUERY) ? epoch_local_as_TReal() : 0.0;


IDEAS is all they need but still they think only Genius can give them that.
Reply With Quote

#6 Old Re: Date problem in python - 2008-08-20, 12:58

Join Date: Sep 2005
Posts: 314
Location: Finland, Helsinki
aaaaapo
Offline
Regular Contributor
Quote:
Originally Posted by mateen_maldar View Post
import appuifw
appuifw.query(u"Type a date:", "date", u"01/01/2008")
Default value for "date" and "time" queries MUST BE a FLOAT.
Confusing, isn't it? But it makes sense if you think what those queries return: epoch as a float (e.g. "1219229900.0").

So try this:

Code:
import appuifw, time
appuifw.query(u"Type a date:", "date", time.time())
appuifw.query(u"Type a time:", "time", time.time())
print time.time()
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
expire date validaton problem ramarao General Symbian C++ 1 2008-01-29 07:28
Sockets problem - C++ exe connecting to Python server zahzaf General Symbian C++ 12 2007-09-27 14:07
Socket problem - Python server - C++ exe client zahzaf Python 1 2007-09-25 04:42
Bluetooth Python Standalone APP problem wallace_nogueira Python 0 2005-05-03 20:25
Problem with Colon " : " Date Separator rave_symbian General Symbian C++ 0 2004-12-07 09:39

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomE2fforumE2fshowthreadE2ephpE3ftE3d81449X qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE44iscussionQ qdcZtypeQUqfntypeZE44iscussionContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtopicQUqfnTopicZpythonQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE44iscussionQ qfnZtypeQUqfntypeZE44iscussionContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qfnZuserE5ftagQSxpythonX qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE44iscussionQ qrdfZtypeQUqfntypeZE44iscussionContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ