JavaScript ရက်စွဲ သတ်မှတ်UTCFullYear()
ဥပမာ
နှစ်ကို 2015 ဟု သတ်မှတ်သည်-
const d = new Date();
d.setUTCFullYear(2015);
အောက်တွင် နောက်ထပ် "စမ်းသုံးကြည့်ပါ" ဥပမာများ။
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
UTC အရ setUTCFullYear() နည်းလမ်းသည် ရက်စွဲအရာဝတ္ထုတစ်ခု၏ နှစ်ကို သတ်မှတ်သည်။
မှတ်စုများ
UTC (Universal Time Coordinated) သည် World Time Standard မှ သတ်မှတ်ထားသော အချိန်ဖြစ်သည်။
UTC အချိန်သည် GMT အချိန် (Greenwich Mean Time) နှင့် တူညီသည်။
Browser ပံ့ပိုးမှု
setUTCFullYear()
ECMAScript1 (ES1) အင်္ဂါရပ်တစ်ခုဖြစ်သည်။
ES1 (JavaScript 1997) ကို ဘရောက်ဆာအားလုံးတွင် အပြည့်အဝ ပံ့ပိုးထားသည်။
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | Yes | Yes | Yes | Yes | Yes |
အထားအသို
Date.setUTCFullYear(year, month, day)
ကန့်သတ်တန်ဖိုးများ
Parameter | Description |
---|---|
year | Required. A value representing the year, negative values are allowed |
month | Optional. 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:
|
တန်ဖိုးကို ပြန်ပေးသည်။
Type | Description |
---|---|
Number | Milliseconds between the date object and midnight January 1 1970 |
နည်းပညာဆိုင်ရာအသေးစိတ်
JavaScript ဗားရှင်း- | ECMAScript ၁ |
---|
နောက်ထပ် ဥပမာများ
ဥပမာ ၂
နိုဝင်ဘာလ 3 ရက်၊ 2020 ခုနှစ် UTC အချိန်မှ ရက်စွဲကို သတ်မှတ်ပါ-
const d = new Date();
d.setUTCFullYear(2020, 10, 3);
ဥပမာ
ရက်စွဲကို လွန်ခဲ့သော ခြောက်လ ၊ UTC အချိန်-
const d = new Date();
d.setUTCFullYear(d.getUTCFullYear, d.getUTCMonth() - 6);