-
25 Jul 2012 6:25 AM #1
Unanswered: how to pass a date format to a Label in form panel
Unanswered: how to pass a date format to a Label in form panel
Hi all, i am trying to pass from my records from my grid to a form with label but i have the problem passing the column type date to a label
Is showing me like this: Mon Oct 22 00:00:00 UTC+0200 2012
When i need something like this : 10/22/2012
ThanksCode:Ext.getCmp('lb_mydate').setText(rec.getAt(rowIndex).data.mydate.);
-
25 Jul 2012 6:37 AM #2Sencha - Community Support Team
- Join Date
- May 2012
- Location
- Istanbul
- Posts
- 1,331
- Vote Rating
- 76
- Answers
- 124
If you want to print your date as some format, then you need to format that date before setting that date in label. Review the following code:
Code:// as you said that your date is coming like 'Mon Oct 22 00:00:00 UTC+0200 2012' // then you need to do like new Date('Mon Oct 22 00:00:00 UTC+0200 2012').format('m/d/Y') // id gives as - "10/22/2012" Ext.getCmp('lb_mydate').setText(new Date(rec.getAt(rowIndex).data.mydate).format('m/d/Y'));sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.
-
25 Jul 2012 6:46 AM #3
-
25 Jul 2012 7:45 AM #4Sencha - Support Team
- Join Date
- Jul 2010
- Location
- Houston, Tx
- Posts
- 7,185
- Vote Rating
- 194
- Answers
- 433
From the console:
> today = new Date()
?Wed Jul 25 2012 10:44:34 GMT-0500 (CDT)
> newdate = Ext.util.Format.date(today, 'm/d/Y');
?"07/25/2012"
Scott.


Reply With Quote