In [1]:
# Versão da Linguagem Python
from platform import python_version
print('Versão da Linguagem Python Usada Neste Jupyter Notebook:', python_version())
In [2]:
import datetime
In [3]:
agora = datetime.datetime.now()
In [4]:
agora
Out[4]:
In [5]:
t = datetime.time(7, 43, 28)
In [6]:
print (t)
In [7]:
print ('Hora :', t.hour)
print ('Minute:', t.minute)
print ('Segundo:', t.second)
print ('Microsegundo:', t.microsecond)
In [8]:
print(datetime.time.min)
In [9]:
hoje = datetime.date.today()
In [10]:
print (hoje)
print ('ctime:', hoje.ctime())
print ('Ano:', hoje.year)
print ('Mês :', hoje.month)
print ('Dia :', hoje.day)
In [11]:
d1 = datetime.date(2015, 4, 28)
print ('d1:', d1)
In [12]:
d2 = d1.replace(year=2016)
print ('d2:', d2)
In [13]:
# Diferença em dias entre duas datas
d2 - d1
Out[13]: