'datetime' module Flashcards
1
Q
var = datetime.module()
A
creates a datetime object
2
Q
now.date()
A
return date in YYYY-MM-DD format
3
Q
now.year
A
return year
4
Q
now.month
A
return month
5
Q
now.day
A
return day
6
Q
now.minute
A
return minute
7
Q
now.second
A
return second
8
Q
now.time()
A
returns current time in HH:MM:SS.ms format
9
Q
now.strftime(āx y zā)
A
format time
10
Q
formatting dates with strftime()
A
#Formatting date display with "Shift Time" # %a -> Mon # %A -> Monday # %d -> 10 # %b -> Jan # %B -> January # %m -> 01
11
Q
formatting time with strftime()
A
#Formatting time with "Shift Time" # %H -> hours # %M -> minutes # %S -> seconds # %p -> AM or PM
12
Q
formatting year with strftime()
A
#Formatting year # %y - 17 # %Y - 2017
13
Q
timedelta(x)
A
calculate times in the past or future
14
Q
calendar.month(x)
A
print a calendar for given year
15
Q
calendar.weekday(x, y, z)
A
determine dates in the future