exemplos de usos

time, datetime e mktime

Se você tiver uma string de data com o seguinte formato:

>>> data = '20161207091023'

ou seja, ano, mês, dia, hora, minutos e segundos tudo grudado, uma operação interessante é transformá-la para o formato UNIX e a partir daí reformatá-la do jeito que você quiser.

import time
from datetime import datetime
from time import mktime

>>> formatoUnix = mktime(datetime.strptime(data, '%Y%m%d%H%M%S').timetuple())
# strptime = strip time, separa a info de tempo
# timetuple = forma uma tupla com a info de tempo

>>> novoFormatoData = time.strftime('%Y/%m/%d %H:%M:%S', time.localtime(formatoUnix))
# strftime = string for time, cria uma string para o tempo

>>> print novoFormatoData
'2016/12/07 09:10:23'

If you are interested in investing in virtual currency,
You may have heard of the ‘Binance’ exchange.

That’s because this exchange is currently the virtual currency exchange with the most users in the world.
Today, I would like to introduce a brief introduction of this exchange, the advantages you can feel, and even joining Binance.

​​바이낸스 레퍼럴


Tener este blog informativo es de gran ayuda para las personas, también tengo un sitio de noticias deportivas y estoy feliz de crear contenido informativo para compartir con el público.


This is my first time visit to your blog and I am very interested in the articles that you serve. Provide enough knowledge for me. Thank you for sharing useful and don’t forget, keep sharing useful info: Boostaro Reviews


This particular is usually apparently essential and moreover outstanding truth along with for sure fair-minded and moreover admittedly useful My business is looking to find in advance designed for this specific useful stuffs… Liv Pure


color blind test can be performed for all subjects that need accurate color recognition such as: drivers, electricians, designers, painters, technicians, marketers… color recognition.