RE: [flexcoders] date formating
Roger, Use the following function. public function gridDateFormatter(item:Object,column:DataGridColumn):String { var f:DateFormatter = new DateFormatter(); f.formatString = "DD-MMM-"; return f.format(item[column.dataField]); } Then on your grid column set the labelfucntion like: Change the format string to match the format you need. B. -Original Message- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Roger Ross Sent: Wednesday, January 31, 2007 2:30 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] date formating Hello, I have a date field in a grid. what is the correct syntax to get it to display MM/DD/ right now it displays as Wed Jan 30 00:00:00 GMT I have as my date format and I added the syntax to the datafield dataField="{df.format(entrydate)}" But this just gives me an error. I found how to do it on a label but I need it formated in a grid column.. Thank you Roger -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links *** The information in this e-mail is confidential and intended solely for the individual or entity to whom it is addressed. If you have received this e-mail in error please notify the sender by return e-mail delete this e-mail and refrain from any disclosure or action based on the information. ***
[flexcoders] date formating
Hello, I have a date field in a grid. what is the correct syntax to get it to display MM/DD/ right now it displays as Wed Jan 30 00:00:00 GMT I have as my date format and I added the syntax to the datafield dataField="{df.format(entrydate)}" But this just gives me an error. I found how to do it on a label but I need it formated in a grid column.. Thank you Roger
RE: [flexcoders] Date formating application wide
Hi, Though this is the quickest possible way, but this kind of hacks might not be supported in future, as Dirk also said. But this indeed shows the power of prototype :) -abdul -Original Message- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Dirk Eismann Sent: Friday, May 13, 2005 6:14 PM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] Date formating application wide Here's an example how to achieve this taken from a current project. First, the default formats are setup by using the mx.formatters.DateBase class. Then, they are applied to the DateChooser class (so it works with the DateChooser and the DateField class) Beware, this technique uses the prototype property (AS 1.0 oop-style) of the DateChooser class which may not work in future versions of Flex. You could also assign a default date formatting function by setting DateChooser.prototype.dateFormatter to a function that returns a formatted Srting. import mx.formatters.DateBase; import mx.controls.DateChooser; DateBase.defaultDayNamesLong = ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Sonnabend"]; DateBase.defaultDayNamesShort = ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"]; DateBase.defaultMonthNamesLong = ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"]; DateBase.defaultMonthNamesShort = ["Jan", "Feb", "Mär", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"]; // assign the above to the DateChooser prototype DateChooser.prototype.monthNames = DateBase.defaultMonthNamesLong; DateChooser.prototype.dayNames = DateBase.defaultDayNamesShort; DateChooser.prototype.firstDayOfWeek = 1; Dirk. > -Original Message- > From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] > Behalf Of joao_m_fernandes > Sent: Friday, May 13, 2005 1:54 PM > To: flexcoders@yahoogroups.com > Subject: [flexcoders] Date formating application wide > > > Hi there, > > Is there a way to set default values other than English formating so > each component uses it instead of setting formatters everywhere. > > Example, If I have several DateFields and DateChoosers I want to be > able just to set in the main Application weekday names (or month > names) and those components use it as default. > > If I set automaticly it should use my definitions of > dayNames and monthNames without setting it directly in the component. > > Any Idea how I can achieve this? > > Thanks, > > João Fernandes > > > > > > Yahoo! Groups Links > > > > > > > Yahoo! Groups Links Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
RE: [flexcoders] Date formating application wide
You can achieve this, if it's not already there. You can subclass DateField and DateChooser component and add this functionality. Following is quick and dirty example to : ##ExtendedDateFieldExample.mxml## http://www.macromedia.com/2003/mxml"; xmlns:local="*"> ##DateFieldEx.as## import mx.controls.DateField; class DateFieldEx extends DateField { //default German month names... private static var defaultMonthNames = ["Januar","Februar","März","April","Mai","Juni","Juli","August","September", "Oktober","November","Dezember"] public function init():Void { super.init(); monthNames = defaultMonthNames; } } On similar lines you can think... Hope that helps.. -abdul -Original Message- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of joao_m_fernandes Sent: Friday, May 13, 2005 5:24 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Date formating application wide Hi there, Is there a way to set default values other than English formating so each component uses it instead of setting formatters everywhere. Example, If I have several DateFields and DateChoosers I want to be able just to set in the main Application weekday names (or month names) and those components use it as default. If I set automaticly it should use my definitions of dayNames and monthNames without setting it directly in the component. Any Idea how I can achieve this? Thanks, João Fernandes Yahoo! Groups Links Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
RE: [flexcoders] Date formating application wide
Here's an example how to achieve this taken from a current project. First, the default formats are setup by using the mx.formatters.DateBase class. Then, they are applied to the DateChooser class (so it works with the DateChooser and the DateField class) Beware, this technique uses the prototype property (AS 1.0 oop-style) of the DateChooser class which may not work in future versions of Flex. You could also assign a default date formatting function by setting DateChooser.prototype.dateFormatter to a function that returns a formatted Srting. import mx.formatters.DateBase; import mx.controls.DateChooser; DateBase.defaultDayNamesLong = ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Sonnabend"]; DateBase.defaultDayNamesShort = ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"]; DateBase.defaultMonthNamesLong = ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"]; DateBase.defaultMonthNamesShort = ["Jan", "Feb", "Mär", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"]; // assign the above to the DateChooser prototype DateChooser.prototype.monthNames = DateBase.defaultMonthNamesLong; DateChooser.prototype.dayNames = DateBase.defaultDayNamesShort; DateChooser.prototype.firstDayOfWeek = 1; Dirk. > -Original Message- > From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] > Behalf Of joao_m_fernandes > Sent: Friday, May 13, 2005 1:54 PM > To: flexcoders@yahoogroups.com > Subject: [flexcoders] Date formating application wide > > > Hi there, > > Is there a way to set default values other than English formating so > each component uses it instead of setting formatters everywhere. > > Example, If I have several DateFields and DateChoosers I want to be > able just to set in the main Application weekday names (or month > names) and those components use it as default. > > If I set automaticly it should use my definitions of > dayNames and monthNames without setting it directly in the component. > > Any Idea how I can achieve this? > > Thanks, > > João Fernandes > > > > > > Yahoo! Groups Links > > > > > > > Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
[flexcoders] Date formating application wide
Hi there, Is there a way to set default values other than English formating so each component uses it instead of setting formatters everywhere. Example, If I have several DateFields and DateChoosers I want to be able just to set in the main Application weekday names (or month names) and those components use it as default. If I set automaticly it should use my definitions of dayNames and monthNames without setting it directly in the component. Any Idea how I can achieve this? Thanks, João Fernandes Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/