(Redirected from How to format time)

Archived:How to format time in PySymbian

From Nokia Developer Wiki
Jump to: navigation, search

Archived.pngAquivado: 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.

Article Metadata
Created: cyke64 (29 Mar 2007)
Last edited: hamishwillee (31 May 2013)

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.

This page was last modified on 31 May 2013, at 04:08.
35 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.