Hybrid View

  1. #1
    Sencha User
    Join Date
    Jun 2010
    Posts
    49
    Vote Rating
    0
    luisoswaldo is on a distinguished road

      0  

    Default Datefield format + mysql

    Datefield format + mysql


    hello friends,

    As you know, to keep a date in mysql this should have the format Y-m-d. I really want to show the date format d-m-Y. I wonder if anyone can tell me if there is any way to handle this with ext or should I convert the date to mysql format before saving accepts?.

    I appreciate any help you can offer.

  2. #2
    Sencha User
    Join Date
    Mar 2011
    Location
    Argentina
    Posts
    36
    Vote Rating
    0
    gustavo21 is on a distinguished road

      0  

    Default


    Try this:

    PHP Code:
     {
             
    xtype'datefield',
             
    id'fecha1',
             
    format'd/m/Y',
             
    allowBlankfalse,
             
    blankText'Requerido'
             
    }, 

  3. #3
    Sencha User
    Join Date
    Jun 2010
    Posts
    49
    Vote Rating
    0
    luisoswaldo is on a distinguished road

      0  

    Default


    Thanks for responding.

    The problem is that if I use the format d-m-Y will not store well in the mysql database.

    To save mysql must be in Y-m-d format. And I need the date is displayed to the user in the format d-m-Y.

    Any idea?

  4. #4
    Sencha User
    Join Date
    Dec 2009
    Posts
    364
    Vote Rating
    2
    raj_plays is on a distinguished road

      0  

    Default


    You can format the date before inserting in DB.
    MYSQL code
    Date_Format('01-08-2011', '%Y-%m-%d');

  5. #5
    Sencha User
    Join Date
    Aug 2010
    Posts
    177
    Vote Rating
    0
    mcadirci is on a distinguished road

      0  

    Default


    Send date in timestamp format instead of dealing with format.
    --
    Mehmet Çadırcı