JavaScript နေ့စွဲ setUTCmonth()
ဥပမာ
လကို မေလ (၄) ရက်နေ့ဟု သတ်မှတ်သည်-
const d = new Date();
d.setUTCMonth(4);
အောက်တွင် နောက်ထပ် "စမ်းသုံးကြည့်ပါ" ဥပမာများ။
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
setUTCMonth() နည်းလမ်းသည် UTC အရ ရက်စွဲအရာဝတ္ထုတစ်ခု၏ လ (0 မှ 11) ကို သတ်မှတ်သည်။
မှတ်ချက်- ဇန်န၀ါရီသည် 0၊ ဖေဖော်ဝါရီသည် 1၊ စသည်တို့ဖြစ်သည်။
မှတ်စုများ
UTC (Universal Time Coordinated) သည် World Time Standard မှ သတ်မှတ်ထားသော အချိန်ဖြစ်သည်။
UTC အချိန်သည် GMT အချိန် (Greenwich Mean Time) နှင့် တူညီသည်။
Browser ပံ့ပိုးမှု
setUTCMonth()
ECMAScript1 (ES1) အင်္ဂါရပ်တစ်ခုဖြစ်သည်။
ES1 (JavaScript 1997) ကို ဘရောက်ဆာအားလုံးတွင် အပြည့်အဝ ပံ့ပိုးထားသည်။
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | Yes | Yes | Yes | Yes | Yes |
အထားအသို
Date.setUTCMonth(month, day)
ကန့်သတ်တန်ဖိုးများ
Parameter | Description |
---|---|
month | Required. An integer representing the month
Expected values are 0-11, but other values are allowed:
|
day | Optional. An integer representing the day of month
Expected values are 1-31, but other values are allowed:
If the month has 31 days:
If the month has 30 days:
|
နည်းပညာဆိုင်ရာအသေးစိတ်
ပြန်ပို့တန်ဖိုး- | ရက်စွဲအရာဝတ္ထုနှင့် ဇန်နဝါရီလ 1 1970 ခုနှစ် သန်းခေါင်ယံအချိန်အကြား မီလီစက္ကန့်အရေအတွက်ကို ကိုယ်စားပြုသည့် နံပါတ် |
---|---|
JavaScript ဗားရှင်း- | ECMAScript ၁ |
နောက်ထပ် ဥပမာများ
ဥပမာ
လကို မေလ (၄) ရက်မှ (၂၀) ရက်နေ့အထိ သတ်မှတ်ပါ။
const d = new Date();
d.setUTCMonth(4, 20);
ဥပမာ
ရက်စွဲကို ပြီးခဲ့သည့်လ၏ နောက်ဆုံးနေ့အဖြစ် သတ်မှတ်ပါ-
const d = new Date();
d.setUTCMonth(d.getUTCMonth(), 0);