JavaScript နေ့စွဲ သတ်မှတ်UTCHours()
ဥပမာ
UTC အချိန်အရ နာရီကို 15 ဟု သတ်မှတ်သည်-
const d = new Date();
d.setUTCHours(15);
အောက်တွင် နောက်ထပ် "စမ်းသုံးကြည့်ပါ" ဥပမာများ။
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
setUTCHours() method သည် UTC အရ date object တစ်ခု၏ နာရီကို သတ်မှတ်သည်။
မိနစ်၊ စက္ကန့်နှင့် မီလီစက္ကန့်များကို သတ်မှတ်ရန်လည်း အသုံးပြုနိုင်သည်။
မှတ်စုများ
UTC (Universal Time Coordinated) သည် World Time Standard မှ သတ်မှတ်ထားသော အချိန်ဖြစ်သည်။
UTC အချိန်သည် GMT အချိန် (Greenwich Mean Time) နှင့် တူညီသည်။
Browser ပံ့ပိုးမှု
setUTCHours()
ECMAScript1 (ES1) အင်္ဂါရပ်တစ်ခုဖြစ်သည်။
ES1 (JavaScript 1997) ကို ဘရောက်ဆာအားလုံးတွင် အပြည့်အဝ ပံ့ပိုးထားသည်။
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | Yes | Yes | Yes | Yes | Yes |
အထားအသို
Date.setUTCHours(hour, min, sec, millisec)
ကန့်သတ်တန်ဖိုးများ
Parameter | Description |
---|---|
hour | Required. An integer representing the hour.
Expected values are 0-23, but other values are allowed:
|
min | Optional. An integer representing the minutes.
Expected values are 0-59, but other values are allowed:
|
sec | Optional. An integer representing the seconds
Expected values are 0-59, but other values are allowed:
|
millisec | Optional. An integer representing the milliseconds
Expected values are 0-999, but other values are allowed:
|
နည်းပညာဆိုင်ရာအသေးစိတ်
ပြန်ပို့တန်ဖိုး- | ရက်စွဲအရာဝတ္ထုနှင့် ဇန်နဝါရီလ 1 1970 ခုနှစ် သန်းခေါင်ယံအချိန်အကြား မီလီစက္ကန့်အရေအတွက်ကို ကိုယ်စားပြုသည့် နံပါတ် |
---|---|
JavaScript ဗားရှင်း- | ECMAScript ၁ |
နောက်ထပ် ဥပမာများ
ဥပမာ
အချိန်ကို 15:35:01 UTC အချိန်အဖြစ် သတ်မှတ်ပါ။
const d = new Date();
d.setUTCHours(15, 35, 1);
ဥပမာ
UTC နည်းလမ်းများကို အသုံးပြု၍ လွန်ခဲ့သော 48 နာရီအချိန်ကို သတ်မှတ်ပါ -
const d = new Date();
d.setUTCHours(d.getUTCHours() - 48);