<button id="mgqzr"></button>
<noscript id="mgqzr"></noscript>
<button id="mgqzr"></button>
<pre id="mgqzr"><sup id="mgqzr"><sub id="mgqzr"></sub></sup></pre>
<noscript id="mgqzr"><b id="mgqzr"></b></noscript><button id="mgqzr"></button>

<noscript id="mgqzr"></noscript><button id="mgqzr"><b id="mgqzr"><th id="mgqzr"></th></b></button>
<pre id="mgqzr"><b id="mgqzr"></b></pre><button id="mgqzr"><menuitem id="mgqzr"><table id="mgqzr"></table></menuitem></button>
<pre id="mgqzr"><input id="mgqzr"></input></pre>

為什么是Date()。dateUTC的第一個索引1和Date()。monthUTC的第一個索引為0? [英] Why is Date().dateUTC&#39;s first index 1 and Date().monthUTC&#39;s first index 0?

查看:146
本文介紹了為什么是Date()。dateUTC的第一個索引1和Date()。monthUTC的第一個索引為0?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

在Actionscript 3中,dateUTC和monthUTC具有不同的索引范圍。

In Actionscript 3, dateUTC and monthUTC have different index ranges.

使用2015年10月12日的日期,UTC日期變量日期

using the date of October 12th, 2015, UTC date variables in Date

var day:int = new Date().dateUTC
//trace = 12
var month:int = new Date().monthUTC
//trace = 9

dateUTC 的范圍是1-31。

The range for dateUTC is 1-31.

monthUTC 的范圍是0-11

為什么dateUTC從1開始,monthUTC從0開始?

why does dateUTC start at 1 and monthUTC start at 0?

推薦答案

還有一個邏輯背后,日子是真正的數字而幾個月沒有。日歷是指帶有數字的日期,并將月份表示為字符串。你永遠不會聽到第4個例子,但你會聽到第6天的例子。由于AS3 Date不提供月份名稱,它只提供從0到11的索引,因為日期是數字Date從1到n正確地提供它們。這里還有另一種背后的邏輯,語言。日期中沒有提供名稱(如月份名稱),因為支持所有語言將會很痛苦。相反,您使用月份索引以任何語言顯示月份(您編碼器提供的月份),另一方面天數不需要,因為它們是數字。

There's a logic behind it as well, days are truly numbers while months are not. Calendars refer to days with number and refers to month as string. You never hear month 4 for example but you do hear day 6 for example. Since AS3 Date does not provide month names it only provides their indexes from 0 to 11, since days are number Date provides them correctly from 1 to n. Here again there's another logic behind it, languages. Names (like month names) are not provided in Date because it would be a pain to support all languages. Instead you use the month indexes to display months in any language (that you the coder provides), on the other hand days don't need that since they are numbers.

在大多數語言中,您將看到類似的模式,因為提供月份名稱很麻煩,因此您可能會從0到11獲得索引。

You will see a similar pattern in most languages since providing month names is cumbersome so instead you will likely get an index from 0 to 11.

這篇關于為什么是Date()。dateUTC的第一個索引1和Date()。monthUTC的第一個索引為0?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持IT屋!

查看全文
登錄 關閉
掃碼關注1秒登錄
發送“驗證碼”獲取 | 15天全站免登陸
亚洲AV无码国产精品
<button id="mgqzr"></button>
<noscript id="mgqzr"></noscript>
<button id="mgqzr"></button>
<pre id="mgqzr"><sup id="mgqzr"><sub id="mgqzr"></sub></sup></pre>
<noscript id="mgqzr"><b id="mgqzr"></b></noscript><button id="mgqzr"></button>

<noscript id="mgqzr"></noscript><button id="mgqzr"><b id="mgqzr"><th id="mgqzr"></th></b></button>
<pre id="mgqzr"><b id="mgqzr"></b></pre><button id="mgqzr"><menuitem id="mgqzr"><table id="mgqzr"></table></menuitem></button>
<pre id="mgqzr"><input id="mgqzr"></input></pre>