Archived:How to format time in PySymbian
Aquivado: Este artigo foi arquivado, pois o conteúdo não é mais considerado relevante para se criar soluções comerciais atuais. Se você achar que este artigo ainda é importante, inclua o template {{ForArchiveReview|escreva a sua justificativa}}.
All PySymbian articles have been archived. PySymbian is no longer maintained by Nokia and is not guaranteed to work on more recent Symbian devices. It is not possible to submit apps to Nokia Store.
All PySymbian articles have been archived. PySymbian is no longer maintained by Nokia and is not guaranteed to work on more recent Symbian devices. It is not possible to submit apps to Nokia Store.
Article Metadata
There are two ways of formatting time.
For SQL you need e32.format_time :
>>> from e32db import format_time
>>> from time import *
>>> t = time()
>>> format_time(t) # for Symbian SQL
u'06/03/2006 23:26:35'
For other uses you can use strftime :
>>> from time import *
>>> strftime('%d/%m/%Y %H:%M:%S')
'06/03/2006 23:26:39'
>>> ctime()
'Mon Mar 06 23:26:49 2006'
>>> strftime("%a, %d %b %Y %H:%M:%S +0000") # email RFC
'Mon, 06 Mar 2006 23:26:59 +0000'
More info about other formatting parameters can be found here.


26 Sep
2009