[{"data":1,"prerenderedAt":299},["ShallowReactive",2],{"blog-\u002Fblog\u002Fjavascript_date_object_timer":3},{"id":4,"title":5,"body":6,"category":287,"cover":288,"csdn":288,"date":289,"description":5,"draft":290,"extension":291,"meta":292,"navigation":248,"path":293,"seo":294,"stem":295,"tags":296,"updated":288,"__hash__":298},"blog\u002Fblog\u002Fjavascript_date_object_timer.md","JavaScript date 对象 定时器",{"type":7,"value":8,"toc":283},"minimark",[9,13,198,210,213,279],[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-dark","\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,231,237,243,250,256,262,268,273],"code",{"__ignoreMap":219},[224,225,228],"span",{"class":226,"line":227},"line",1,[224,229,230],{},"\u002F\u002F 间隔循环执行\n",[224,232,234],{"class":226,"line":233},2,[224,235,236],{},"var time = setInterval(function () {}, 1000);\n",[224,238,240],{"class":226,"line":239},3,[224,241,242],{},"clearInterval(time);\n",[224,244,246],{"class":226,"line":245},4,[224,247,249],{"emptyLinePlaceholder":248},true,"\n",[224,251,253],{"class":226,"line":252},5,[224,254,255],{},"\u002F\u002F 延迟执行\n",[224,257,259],{"class":226,"line":258},6,[224,260,261],{},"var time2 = setTimeout(function () {}, 1000);\n",[224,263,265],{"class":226,"line":264},7,[224,266,267],{},"clearTimeout(time2);\n",[224,269,271],{"class":226,"line":270},8,[224,272,249],{"emptyLinePlaceholder":248},[224,274,276],{"class":226,"line":275},9,[224,277,278],{},"\u002F\u002F 全局对象 window上 的方法，内部函数 this 指向 Window\n",[280,281,282],"style",{},"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":233,"depth":233,"links":284},[285,286],{"id":12,"depth":233,"text":12},{"id":212,"depth":233,"text":212},"前端",null,"2020-01-10",false,"md",{},"\u002Fblog\u002Fjavascript_date_object_timer",{"title":5,"description":5},"blog\u002Fjavascript_date_object_timer",[297],"JavaScript","sAK8c_GrbPLTasSBQAK3cHbvnaTmENssXjFpNKMr9xk",1780076049009]