I am using ExtJS DateField in an ASP.NET MVC web application.
I set the property formatto "Ymd" so that it correctly analyzes the format "2009-08-11" from the server and also sends it back in this format.
format
However, I would like to display the data in a different, more user-friendly format, in particular "d mmm yyyy" in Spanish.
I can’t figure out how to do this. I don’t think the property altFormatscan help, as it just adds more parsing formats.
altFormats
Can I use a different parsing format from the display format? Or am I mistaken about this?
Yes. It is possible.
See http://extjs.com/deploy/dev/docs/?class=Date for date formats.
For what can be configured out of the box, see the ext-3.0.0 \ src \ locale \ folder. Include the appropriate file or simply configure it yourself using the files as a template.
For example:
Date.monthNames = [ "Januar", "Februar", "Marec", "April", "Maj", "Junij", "Julij", "Avgust", "September", "Oktober", "November", "December" ]; Date.dayNames = [ "Nedelja", "Ponedeljek", "Torek", "Sreda", "Četrtek", "Petek", "Sobota" ]; console.log((new Date()).format('Y-M-D'))
Regards, Joshua
In fact, the configuration is formatused both for AND parsing and for setting the display format. While it altFormatscontains all the possible data formats that you want to support for parsing (the default includes Ymd), you should do something like this:
Ext.onReady(function(){ new Ext.form.DateField({ format: 'd F Y', // 'd mmm yyyy' is not valid, but I assume this is close? width: 200, renderTo: Ext.getBody(), value: '2009-08-11' }); });
, , , :
, , , ('d mmm yyyy') (: 'd mmm yyyy), , ( ), , DateTime. , :
DateTime.ParseExact(myDate, 'd mmm yyyy', CultureInfo.CurrentCulture)
, , .
"" . , Ext , , Ext/Javascript, , /, - .
, /, , .
, .
DateField TimeField: http://www.rahulsingla.com/blog/2010/05/extjs-date-time-field-plugins-for-efficient-data-entry