1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    219
    Answers
    10
    Vote Rating
    5
    webfriend13 is on a distinguished road

      0  

    Default Unanswered: Datefield format

    Unanswered: Datefield format


    Hi all,

    I am having a datefield control in my page.
    Code:
      {
                                   xtype: 'datefield',
                                   id: 'to-datefield',
                                   maxValue: new Date(),
                                   value: new Date(),
                                   editable: false,
                                   disabledDays:  [0, 6],
                                    format: 'd M Y',  ///This is the format in which i want to show date in textbox (datefield)
                                   submitFormat : 'Y m d'  //this is the format in which it should return value
                               },

    I want to show date in 01 Jan 2012 format which is working fine. But when I read the value of datefield. I want the value in 'Y m d' format. This is not working.

    Code:
    var toDate = Ext.getCmp('to-datefield').getValue();
    So if user have selected 16 Oct 2012, using var toDate = Ext.getCmp('to-datefield').getValue(); returns me "Tue Oct 16 00:00:00 UTC+0800 2012" instead of returning "20121610". How can i make this control to return date in 'Y m d' format???

    I want to store the date as 20121610 (Y m d format). I also want to know how can i assign this value (20121610) back to datefield control when i am loading the control.

  2. #2
    Ext JS Premium Member tvanzoelen's Avatar
    Join Date
    Apr 2008
    Location
    Groningen - Netherlands
    Posts
    1,114
    Answers
    83
    Vote Rating
    30
    tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about

      0  

    Default


    Probably it will format the date with submitFormat if you post it as a form.

    I see in the docs a funtions that will return the pair key value that will probably return the desired frmat.

    Code:
    var keyPair = Ext.getCmp('to-datefield').getSubmitValue();
    or else you can try to format it yourself

    Code:
    var val = Ext.Date.format( Ext.getCmp('to-datefield').getValue(), 'Y m d');
    or

    Code:
    var val = Ext.Date.format( new Date(Ext.getCmp('to-datefield').getValue()), 'Y m d');

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi