Zend Framework - JQuery - Date Picker - Format Date to YYYY-mm-dd

前端 未结 4 1622
被撕碎了的回忆
被撕碎了的回忆 2021-01-23 15:56

Im using a JQuery DatePicker in a Zend Framework based application Form. Here is the code for the date picker

$this->addElement(\'datePicker\',\'movie_release         


        
相关标签:
4条回答
  • 2021-01-23 16:28

    Ok I finally found how to do it:

    $element = new ZendX_JQuery_Form_Element_DatePicker('dp1',
                array('jQueryParams' => array('dateFormat' => 'yy-mm-dd'))
            );
    $this->addElement($element);
    

    That's it! Thanks for your help.

    0 讨论(0)
  • 2021-01-23 16:31

    Be aware that safari does not recognise the format YYYY-MM-DD

    Invalid date in safari

    0 讨论(0)
  • 2021-01-23 16:38

    First use Zend_Locale to set up date format, then with ZendX_JQuery:

    $picker = new ZendX_JQuery_View_Helper_DatePicker();
    $picker->resolveZendLocaleToDatePickerFormat();
    
    0 讨论(0)
  • 2021-01-23 16:40

    Try adding this to your array:

    'dateFormat' => 'yy-mm-dd',
    

    If you're still having trouble, see if you can upgrade to the most recent version of the control from jQuery UI's site. Here is usage documentation for date formats: http://jqueryui.com/demos/datepicker/#date-formats

    0 讨论(0)
提交回复
热议问题