Python Tutorial for beginners | Playing with Date and Time in Python

Publicado em: 27 Abril 2020
no canal de: harshal mishra
12
0

'''
DateTime
1. How to initialize
2. Playing with Date Objects
3. TimeDelta
4. Conversion to diferent date formats
'''

import datetime
x = datetime.date(2019, 12, 12)
y= datetime.datetime(2019,12,12,10,00,00)
print(x)
print(y)
print(x.year)
print(x.month)
print(x.day)

#TimeDelta - It represents the difference in time between two Objects
x = datetime.date(year = 2019, month = 1, day = 1)
y = datetime.date(year = 2020, month = 1, day = 1)
print(y-x)
print(type(y-x))
print((y-x).total_seconds())

now = datetime.datetime.now()
print(now)
print(now.strftime("%d/%m/%Y, %H:%M:%S"))
print(now.strftime("%d-%m-%Y, %H:%M:%S"))


Nesta página do site você pode assistir ao vídeo on-line Python Tutorial for beginners | Playing with Date and Time in Python duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário harshal mishra 27 Abril 2020, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 12 vezes e gostou 0 espectadores. Boa visualização!