th
i
tgetdayretur
daystri
ggetweekretur
weekvoidsetyeari
t
yearyear
yearvoidsetmo
thi
t
mo
thmo
th
mo
thvoidsetdayi
t
dayday
dayvoidsetweekstri
gcweekcvoidreseti
ty0i
tm0i
td0dateoperatorco
stdatetdateoperatorco
stdatetclassdatetimepublicdatepublictimeprivatepublic
datetimedatetimei
t
yeari
t
mo
thi
t
dayi
t
houri
t
mi
utei
t
seco
ddatetimei
t
yeari
t
mo
thi
t
daytimecdatetimedateti
t
houri
t
mi
utei
t
seco
ddatetimeaddbyseco
ddatetimeoperatordatetimetdatetimeoperatordatetimet
ftimetime判断时间并进行赋值hour0mi
ute0seco
d0
timetimei
t
houri
t
mi
utei
t
seco
d
if
hour24
hour0hour0elsehour
hour
if
mi
ute59
mi
ute0mi
ute0elsemi
ute
mi
uteif
seco
d59
seco
d0
seco
d0elseseco
d
seco
d
timetimetimec
hourchourmi
utecmi
ute
fseco
dcseco
d
timetimetime析构函数
datedatedate构造函数
year0mo
th0day0
datedatei
tyi
tmi
td
ify1900
y1900elseyeary
ifm12m0
m1elsemo
thm
i
tmaxday0
fifm2ifisleapyearyear
maxday29else
maxday28elsemaxdaymo
mifdmaxdayd0
d1dayd
datedatedatet
yeartyearmo
thtyeardaytday
fdatedatevoiddatereseti
tyi
tmi
td
thisyearythismo
thmthisdayd
datetimedatetimedatetime
datetimedatetimei
t
yeari
t
mo
thi
t
dayi
t
houri
t
mi
utei
t
seco
ddate
year
mo
th
daytime
hour
mi
ute
seco
d
datetimedatetimei
t
yeari
t
mo
thi
t
daytime
ctimecdate
year
mo
th
day
datetimedatetimedateti
t
houri
t
mi
utei
t
seco
ddatettime
hour
mi
ute
seco
d
datetimedatetimeaddbyseco
d
thissetseco
dthisgetseco
d1
ifthisgetseco
d59
thissetseco
d0
thissetmi
utethisgetmi
ute1
ifthisgetmi
ute59
fthissetmi
ute0thissethourthisgethour1ifthisgethour23
thissethour0thissetdaythisgetday1
ifthisgetdaymo
_daythisgetyearthisgetmo
ththissetday1thissetmo
ththisgetmo
th1ifthisgetmo
th12thissetmo
th1thissetyearthisgetyear1
retur
this
datetimedatetimeoperatordatetimet
fthissetyeartgetyearthissetmo
thtgetmo
ththissetdaytgetdaythissethourtgethourthissetmi
utetgetmi
utethissetseco
dtgetseco
dretur
this
datetimedatetimeoperatordatetimetifthisgetyeartgetyear1900
thissetyear1900elsethissetyearthisgetyeartgetyear
ifthisgetmo
thtgetmo
th12
thisgetmor