We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 6
Si dung
Lay théng tin date-time hién tai
etree acts
ee cssUrerTO)
Petco}
Cay
pea ena)
eee cis
co ee Tis
Pot enCrmr utc)
Pee ee)
timestamp = now.timestamp()
print(day, month, year, hour, minute)
print(
print(#
Format output
Pa eran estte)
Soe eat htc
Coe ries ccCer6)
Pee ee secrters}
rint("time:", t)
PC eee asta
ea Gres
sua ence
print("time two:", time_two)
XEm thém dinh dang tai
Sun Weekday as locale's
abbreviated name.mA Sunday Weekday as locale’s full
name,
Kw 6 Weekday as a decimal
number, where 0 is Sunday
and 6 is Saturday.
xd 08 Day of the month as a
zero-padded decimal
number.
%d 8 Day of the month as a
decimal number. (Platform
specific)
% sep Month as locale’s
abbreviated name.
xB septenber Month as locale's full name.
mn e9 Month as a zero-padded
decimal number
em 9 Month as a decimal number.
(Platform specific)
Hy 3B Year without century as a
zero-padded decimal
number.
xy 2013 Year with century as a
decimal number.
oH 7 Hour (24-hour clock) as a
zero-padded decimal
number.
KH 7 Hour (24hour clock) as a
decimal number. (Platform
specific)
xr 7 Hour (12-hour clock) as a
zero-padded decimal
number.
%-I 7 Hour (12-hour clock) as a
decimal number. (Platform
specific)
xp aM Locale's equivalent of either
AM or PM.
x 06 Minute as a zero-padded
decimal number.Minute as a decimal
number. (Platform specific)
5.
Second as a zero-padded
decimal number.
Second as a decimal
number. (Platform specific)
x
200000
Microsecond as a decimal
number, zero-padded to 6
digits.
x
+2000
UTC offset in the form
HHMMISSL fff] (empty
string if the object is naive).
xz
ure
Time zone name (empty
string if the object is naive)
xj
251,
Day of the year as a
zero-padded decimal
number.
251,
Day of the year as a decimal
number. (Platform specific)
mu
36
Week number of the year
(Sunday as the first day of
the week) as a zero-padded
decimal number. All days in
anew year preceding the
first Sunday are considered
tobe in week 0.
xu
36
Week number of the year
(Sunday as the first day of
the week) as a decimal
number. Al days in a new
year preceding the first
Sunday are considered to be
in week 0. (Platform
specific)
ma
35
Week number of the year
(Monday as the first day of
the week) as a zero-padded
decimal number. All days in
anew year preceding the
first Monday are considered
to be in week 0.
35
Week number of the year(Monday as the first day of
the week) as a decimal
number. Al days in a new
year preceding the first
Monday are considered to
be in week 0. (Platform
specific)
we Sun Sep 8 07:06: 2013 | Locale's appropriate date
and time representation.
mx 09/08/13 Locale's appropriate date
representation.
~« 07:06:05 Locale's appropriate time
representation.
%% % A literal" character.
String to time
poet wera’
tring f
PStsar!
Peay
Pets
Creris
ees
ecm caer ee
Date
ee curcrens
Clears erro)
)
rrent dat
Smee
Peet
eye
ate_string)
strptime(date_string,
ere
PPE
» d.today())
a
cnStee an ea LAL eed
Pt aetna ean aL ee
Time Object
SU ese c eases
Ces CS Cee
Preasuso)
Star wearer)
PecUNCCimeC un ae ercot))
b = time(10, 30, 50)
print("b =", b)
ees C CCU Cee RSL)
Cec rn
cSt Gas)
Rec nee Reco)
Cec CCE Er EEES)
print("d =", d)
rag
Peed
eect)
eect)
cert)
Khoang cach théi gian
Pua
Pe sco C atria)
Re cece eRe See)
me tLe ete eae
coC eee ec
# Time left for new year: 27 days, 0:00:00
PUG cae ee SUC Coca COT)
Some esc Urc ts Ss eer]
eSeee)
tr eee eee
Pao ea}
Crean
Pees Cen mrs
cee
Cet eC neesurt ste
t1 = timedelta(weeks=12, day ct
pears U StriC Oe aT
SeaTac)
print("t3 =", t3)
Thu hanh
Ly ra ngay théng ném hin tal bing nhiBu céch khée nhau
Khai béo ngay thang nam sinh, tinh xem ban 48 séng due bao nhiéu ngay
Tinh xem 999 ngay sau la ngay thang nam nao