Páginas

sábado, 11 de julio de 2015

Python: Como obtener la fecha de hoy (Y cambiar el formato de fecha)

 
Con el modulo datetime ha sido super sencillo! incluso se puede especificar la forma en que  queremos que se presente la fecha, mes dia año o viceversa.
Aqui un ejemplo:  

 
>>> import datetime
>>> fecha = datetime.date.today()
>>> fecha
datetime.date(2015, 7, 11)
>>> fecha.day
11
>>> fecha.month
7
>>> fecha.year
2015
>>> fecha.strftime('%d-%m-%y')
'11-07-15'
>>> fecha.strftime('%Y/%m/%d')
'2015/07/11'
>>> 

1 comentario:

  1. A 3D printer is able to|is ready to} achieve a better level of detail in a shorter time frame than some other strategies. While this will require a great amount of creativity, when you have the imaginative and prescient to reimagine how one thing is made to make it higher, more sustainable or more cost-effective, you can to|you possibly can} flip to 3D printing. You might also take an current product design and make it higher or easier to make use of for the buyer. Another potential way to Nipple Covers improve upon current products is to add customization.

    ResponderEliminar