[Dojo-interest] A little confusion about dojo date time support

Eugene Lazutkin eugene.lazutkin at gmail.com
Mon Dec 3 08:02:12 UTC 2007


You asked about the Date object, which is part of the JavaScript
standard. It is not part of Dojo.

The standard stipulates that months are numbered 0-11, but date (days)
are 1-31. Yep, it looks illogical to me too, but there is nothing we can
do about it now. You can bug Brendan Eich
(http://en.wikipedia.org/wiki/Brendan_Eich) about that. ;-)

Thanks,

Eugene

Hui Jian He wrote:
> So 0 means Jan in new date()? Why it should like this? Anybody know the
> purpose of this design?
> 
> 
> 
> 
> Inactive hide details for John Michael Luy ---2007-12-03
> 15:35:30---Hi,John Michael Luy ---2007-12-03 15:35:30---Hi,
> 
>                         *John Michael Luy <jmluy17 at gmail.com>*
>                         Sent by: dojo-interest-bounces at dojotoolkit.org
> 
>                         2007-12-03 15:23
>                         Please respond to
>                         dojo-interest at dojotoolkit.org
> 
> 	
> 
> To
> 	
> dojo-interest at dojotoolkit.org
> 
> cc
> 	
> 
> Subject
> 	
> Re: [Dojo-interest] A little confusion about dojo date time support
> 
> 	
> 
> 
> Hi,
> 
> The month in new date(..) is from 0 to 11.
> 
> Hui Jian He wrote:
>>
>> Hi All
>>
>> I have some confusion about the dojo date time support for culture
>> convention.
>>
>>
> http://www.dojotoolkit.org/book/dojo-book-0-9/part-3-programmatic-dijit-and-dojo/i18n/number-and-currency-formatting
>>
>> This is a sample:
>>
>> // the page must specify djConfig.extraLocale: 'zh-cn' to bootstrap
>> the environment with support for an extra locale
>> dojo.require("dojo.date.locale");
>> var d = new Date(2006,9,29,12,30);
>> // to format a date, simply pass the date to the format function
>> dojo.date.locale.format(d);
>> => "10/29/06 12:30 PM"
>> // the second argument may contain a list of options in Object syntax,
>> such as overriding the default locale
>> dojo.date.locale.format(d, {locale:'zh-cn'})
>> => "06-10-29 下午12:30"
>>
>>
>> My question is why the data (2006,9,29,12,30) will be formatted to
>> 10/29/06 12:30 PM. Why the month will be added one?
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> FAQ: http://dojotoolkit.org/support/faq
>> Book: http://dojotoolkit.org/docs/book
>> Forums: http://dojotoolkit.org/forum
>> Dojo-interest at dojotoolkit.org
>> http://dojotoolkit.org/mailman/listinfo/dojo-interest
>>  
> 
> _______________________________________________
> FAQ: http://dojotoolkit.org/support/faq
> Book: http://dojotoolkit.org/docs/book
> Forums: http://dojotoolkit.org/forum
> Dojo-interest at dojotoolkit.org
> http://dojotoolkit.org/mailman/listinfo/dojo-interest
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> FAQ: http://dojotoolkit.org/support/faq
> Book: http://dojotoolkit.org/docs/book
> Forums: http://dojotoolkit.org/forum
> Dojo-interest at dojotoolkit.org
> http://dojotoolkit.org/mailman/listinfo/dojo-interest



More information about the Dojo-interest mailing list