Il giorno Fri, 28 Jun 2013 03:01:02 +0200
Marcello <marce...@linuxvil.it> ha scritto:

> Ciao a *
> 
> ho una stringa che recupero da un DB
> tempo = "2013-06-25 16:25:00"
> 
> e dovrei modificare in
> 25/06/2013 16:25
> 
> potrei utilizzare string per spostare i caratteri, ma vorrei utilizzare
> time per vari motivi.
> quindi provo con
> 
> print time.strftime("%d/%m/%Y %H.%M" ,time.localtime(tempo))
> 
> [...]

così?

>>> tempo = "2013-06-25 16:25:00"
>>> time.strftime("%d/%m/%Y %H:%M", time.strptime(tempo,"%Y-%m-%d %H:%M:%S"))
'25/06/2013 16:25'

(localtime non si aspetta una stringa)



Attachment: signature.asc
Description: PGP signature

_______________________________________________
Python mailing list
Python@lists.python.it
http://lists.python.it/mailman/listinfo/python

Rispondere a