[{"data":1,"prerenderedAt":352},["ShallowReactive",2],{"blog-\u002Fblog\u002Fjavascript_date_object_timer":3},{"id":4,"title":5,"body":6,"category":339,"cover":340,"csdn":340,"date":341,"description":5,"draft":342,"extension":343,"meta":344,"navigation":280,"path":345,"seo":346,"stem":347,"tags":348,"updated":340,"__hash__":351},"blog\u002Fblog\u002Fjavascript_date_object_timer.md","JavaScript date 对象 定时器",{"type":7,"value":8,"toc":335},"minimark",[9,13,198,210,213,331],[10,11,12],"h2",{"id":12},"date对象",[14,15,16,29],"table",{},[17,18,19],"thead",{},[20,21,22,26],"tr",{},[23,24,25],"th",{},"方法",[23,27,28],{},"描述",[30,31,32,41,49,57,65,73,81,89,97,110,118,126,134,142,150,158,166,174,182,190],"tbody",{},[20,33,34,38],{},[35,36,37],"td",{},"getDate()",[35,39,40],{},"从 Date 对象返回一个月中的某一天 (1 ~ 31)。",[20,42,43,46],{},[35,44,45],{},"getDay()",[35,47,48],{},"从 Date 对象返回一周中的某一天 (0 ~ 6)。",[20,50,51,54],{},[35,52,53],{},"getMonth()",[35,55,56],{},"从 Date 对象返回月份 (0 ~ 11)。",[20,58,59,62],{},[35,60,61],{},"getFullYear()",[35,63,64],{},"从 Date 对象以四位数字返回年份。",[20,66,67,70],{},[35,68,69],{},"getHours()",[35,71,72],{},"返回 Date 对象的小时 (0 ~ 23)。",[20,74,75,78],{},[35,76,77],{},"getMinutes()",[35,79,80],{},"返回 Date 对象的分钟 (0 ~ 59)。",[20,82,83,86],{},[35,84,85],{},"getSeconds()",[35,87,88],{},"返回 Date 对象的秒数 (0 ~ 59)。",[20,90,91,94],{},[35,92,93],{},"getMilliseconds()",[35,95,96],{},"返回 Date 对象的毫秒(0 ~ 999)。",[20,98,99,105],{},[35,100,101],{},[102,103,104],"strong",{},"getTime()",[35,106,107],{},[102,108,109],{},"返回 1970 年 1 月 1 日至今的毫秒数。",[20,111,112,115],{},[35,113,114],{},"setDate()",[35,116,117],{},"设置 Date 对象中月的某一天 (1 ~ 31)。",[20,119,120,123],{},[35,121,122],{},"setMonth()",[35,124,125],{},"设置 Date 对象中月份 (0 ~ 11)。",[20,127,128,131],{},[35,129,130],{},"setFullYear()",[35,132,133],{},"设置 Date 对象中的年份（四位数字）。",[20,135,136,139],{},[35,137,138],{},"setHours()",[35,140,141],{},"设置 Date 对象中的小时 (0 ~ 23)。",[20,143,144,147],{},[35,145,146],{},"setMinutes()",[35,148,149],{},"设置 Date 对象中的分钟 (0 ~ 59)。",[20,151,152,155],{},[35,153,154],{},"setSeconds()",[35,156,157],{},"设置 Date 对象中的秒钟 (0 ~ 59)。",[20,159,160,163],{},[35,161,162],{},"setMilliseconds()",[35,164,165],{},"设置 Date 对象中的毫秒 (0 ~ 999)。",[20,167,168,171],{},[35,169,170],{},"setTime()",[35,172,173],{},"以毫秒设置 Date 对象。",[20,175,176,179],{},[35,177,178],{},"toString()",[35,180,181],{},"把 Date 对象转换为字符串。",[20,183,184,187],{},[35,185,186],{},"toTimeString()",[35,188,189],{},"把 Date 对象的时间部分转换为字符串。",[20,191,192,195],{},[35,193,194],{},"toDateString()",[35,196,197],{},"把 Date 对象的日期部分转换为字符串。",[199,200,201,202,209],"p",{},"参考 ",[203,204,208],"a",{"href":205,"rel":206},"https:\u002F\u002Fwww.w3school.com.cn\u002Fjsref\u002Fjsref_obj_date.asp",[207],"nofollow","w3school"," 部分资料。",[10,211,212],{"id":212},"定时器",[214,215,220],"pre",{"className":216,"code":217,"language":218,"meta":219,"style":219},"language-js shiki shiki-themes github-light","\u002F\u002F 间隔循环执行\nvar time = setInterval(function () {}, 1000);\nclearInterval(time);\n\n\u002F\u002F 延迟执行\nvar time2 = setTimeout(function () {}, 1000);\nclearTimeout(time2);\n\n\u002F\u002F 全局对象 window上 的方法，内部函数 this 指向 Window\n","js","",[221,222,223,232,266,275,282,288,311,320,325],"code",{"__ignoreMap":219},[224,225,228],"span",{"class":226,"line":227},"line",1,[224,229,231],{"class":230},"sAwPA","\u002F\u002F 间隔循环执行\n",[224,233,235,239,243,246,250,253,256,259,263],{"class":226,"line":234},2,[224,236,238],{"class":237},"sD7c4","var",[224,240,242],{"class":241},"sgsFI"," time ",[224,244,245],{"class":237},"=",[224,247,249],{"class":248},"s7eDp"," setInterval",[224,251,252],{"class":241},"(",[224,254,255],{"class":237},"function",[224,257,258],{"class":241}," () {}, ",[224,260,262],{"class":261},"sYu0t","1000",[224,264,265],{"class":241},");\n",[224,267,269,272],{"class":226,"line":268},3,[224,270,271],{"class":248},"clearInterval",[224,273,274],{"class":241},"(time);\n",[224,276,278],{"class":226,"line":277},4,[224,279,281],{"emptyLinePlaceholder":280},true,"\n",[224,283,285],{"class":226,"line":284},5,[224,286,287],{"class":230},"\u002F\u002F 延迟执行\n",[224,289,291,293,296,298,301,303,305,307,309],{"class":226,"line":290},6,[224,292,238],{"class":237},[224,294,295],{"class":241}," time2 ",[224,297,245],{"class":237},[224,299,300],{"class":248}," setTimeout",[224,302,252],{"class":241},[224,304,255],{"class":237},[224,306,258],{"class":241},[224,308,262],{"class":261},[224,310,265],{"class":241},[224,312,314,317],{"class":226,"line":313},7,[224,315,316],{"class":248},"clearTimeout",[224,318,319],{"class":241},"(time2);\n",[224,321,323],{"class":226,"line":322},8,[224,324,281],{"emptyLinePlaceholder":280},[224,326,328],{"class":226,"line":327},9,[224,329,330],{"class":230},"\u002F\u002F 全局对象 window上 的方法，内部函数 this 指向 Window\n",[332,333,334],"style",{},"html pre.shiki code .sAwPA, html code.shiki .sAwPA{--shiki-default:#6A737D}html pre.shiki code .sD7c4, html code.shiki .sD7c4{--shiki-default:#D73A49}html pre.shiki code .sgsFI, html code.shiki .sgsFI{--shiki-default:#24292E}html pre.shiki code .s7eDp, html code.shiki .s7eDp{--shiki-default:#6F42C1}html pre.shiki code .sYu0t, html code.shiki .sYu0t{--shiki-default:#005CC5}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":219,"searchDepth":234,"depth":234,"links":336},[337,338],{"id":12,"depth":234,"text":12},{"id":212,"depth":234,"text":212},"JavaScript",null,"2020-01-10",false,"md",{},"\u002Fblog\u002Fjavascript_date_object_timer",{"title":5,"description":5},"blog\u002Fjavascript_date_object_timer",[339,349,212,350],"Date","时间处理","9sn6x0EMAf_aeWJ3m2LMROFmoU7k8TBPtBXF74vJRnk",1793010849155]