जावास्क्रिप्ट दिनांक। यूटीसी ()
उदाहरण
दिनांक और 1 जनवरी, 1970 के बीच मिलीसेकंड की संख्या प्राप्त करें:
let ms = Date.UTC(2020, 02, 30);
नीचे और अधिक "इसे स्वयं आज़माएं" उदाहरण।
परिभाषा और उपयोग
UTC के अनुसार, Date.UTC() विधि एक निर्दिष्ट तिथि और 1 जनवरी, 1970 की मध्यरात्रि के बीच मिलीसेकंड की संख्या लौटाती है।
टिप्पणियाँ
UTC (यूनिवर्सल टाइम कोऑर्डिनेटेड) वर्ल्ड टाइम स्टैंडर्ड द्वारा निर्धारित समय है।
UTC समय GMT समय (ग्रीनविच मीन टाइम) के समान है।
ब्राउज़र समर्थन
Date.UTC()
एक ECMAScript1 (ES1) सुविधा है।
ES1 (जावास्क्रिप्ट 1997) सभी ब्राउज़रों में पूरी तरह से समर्थित है:
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | Yes | Yes | Yes | Yes | Yes |
वाक्य - विन्यास
Date.UTC(year, month, day, hours, minutes, seconds, millisec)
Date.UTC() दिनांक वस्तु की एक स्थिर विधि है।
आप इसे d.UTC() जैसी किसी तिथि पर उपयोग नहीं कर सकते हैं
सिंटैक्स हमेशा Date.UTC() होता है।
पैरामीटर मान
Parameter | Description |
---|---|
year | Required. A four-digit value representing the year, negative values are allowed |
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:
|
hour | Optional. Default 0. An integer representing the hour.
Expected values are 0-23, but other values are allowed:
|
min | Optional. Default 0. An integer representing the minutes.
Expected values are 0-59, but other values are allowed:
|
sec | Optional. Default 0. An integer representing the seconds
Expected values are 0-59, but other values are allowed:
|
millisec | Optional. Default 0. An integer representing the milliseconds
Expected values are 0-999, but other values are allowed:
|
टेक्निकल डिटेल
प्रतिलाभ की मात्रा: | एक संख्या, निर्दिष्ट दिनांक-समय और मध्यरात्रि 1 जनवरी 1970 के बीच मिलीसेकंड की संख्या का प्रतिनिधित्व करती है |
---|---|
जावास्क्रिप्ट संस्करण: | ईसीएमएस्क्रिप्ट 1 |
और ज्यादा उदाहरण
उदाहरण
स्थानीय समय के बजाय यूटीसी समय का उपयोग करके दिनांक वस्तु बनाएं:
let d = new Date(Date.UTC(2020, 02, 30));