You Are Here:

Community: Developer Discussion Boards

#1 Old Date object - 2008-10-30, 23:44

Join Date: Mar 2003
Posts: 7
apffal
Offline
Registered User
In Python for S60, is it possible convert a date object, from a query or a form, to a string ?
If possible, how to do it ?
Thanks
Reply With Quote

#2 Old Re: Date object - 2008-10-31, 00:09

Join Date: Feb 2008
Posts: 743
Location: Belo Horizonte, Brazil
Send a message via Skype™ to Rafael T.
Rafael T.'s Avatar
Rafael T.
Offline
Forum Nokia Champion
Quote:
Originally Posted by apffal View Post
In Python for S60, is it possible convert a date object, from a query or a form, to a string ?
If possible, how to do it ?
Thanks
Hi apffal,

Yes, you can convert a date to a string using a query/form.

For example:

Code:
import appuifw

date = appuifw.query(u"Type a date:", "date")

In this case, 'date' variable will be what the user typed in the query, that will be already set for a date input


Hope it helps,

Rafael.
Last edited by Rafael T. : 2008-10-31 at 00:18.
Reply With Quote

#3 Old Re: Date object - 2008-10-31, 00:27

Join Date: Mar 2003
Posts: 7
apffal
Offline
Registered User
But, if I use that code in a query with, for instance, today's date, it prints the string '1225324800.0'
What's wrong ?
Reply With Quote

#4 Old Re: Date object - 2008-10-31, 01:56

Join Date: Feb 2008
Posts: 743
Location: Belo Horizonte, Brazil
Send a message via Skype™ to Rafael T.
Rafael T.'s Avatar
Rafael T.
Offline
Forum Nokia Champion
Quote:
Originally Posted by apffal View Post
But, if I use that code in a query with, for instance, today's date, it prints the string '1225324800.0'
What's wrong ?
Hi apffal,

You're right. It returns this big numbers because they are displayed in seconds

From Python Library Reference:

Quote:
•For date fields, it is seconds since epoch rounded down to the nearest local midnight.
Unfortunately, you can't display the date directly in default mode (dd/mm/yyyy)


BR,

Rafael.
Reply With Quote

#5 Old Re: Date object - 2008-10-31, 05:29

Join Date: Oct 2007
Posts: 2,841
Location: Deva, Romania
bogdan.galiceanu's Avatar
bogdan.galiceanu
Offline
Forum Nokia Champion
See localtime([secs]) and then strftime(format[, t]) here.
Reply With Quote

#6 Old Re: Date object - 2008-10-31, 13:40

Join Date: Mar 2003
Posts: 7
apffal
Offline
Registered User
Problem solved.
Thank you.
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
Starting a new Active Object from a existing Active Object A.Vogel General Symbian C++ 4 2007-11-26 14:41
How 2 chk TTime object contains date & time in correct format sameer.chaudhari General Symbian C++ 6 2007-09-28 06:36
Page builder giogiogio Python 2 2007-08-26 19:08
preverify error. PLZ HELP michaelhann89 Mobile Java Tools & SDKs 14 2007-03-22 23:51
convert Date object to string artemg Mobile Java General 4 2006-03-03 05:56

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