Zend 框架 - JQuery - 日期选择器 - 将日期格式化为 YYYY-mm-dd [英] Zend Framework - JQuery - Date Picker - Format Date to YYYY-mm-dd

查看:13
本文介绍了Zend 框架 - JQuery - 日期选择器 - 将日期格式化为 YYYY-mm-dd的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在基于 Zend 框架的应用程序表单中使用 JQuery DatePicker.这是日期选择器的代码

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_date', array(
            'label' => 'Release Date:',
            'required'=> false
            )
    );

默认情况下,当您选择日期时,它会存储在文本输入中,例如 'mm/dd/yyyy'

By default, when you pick the date, it is stored in the text input like 'mm/dd/yyyy'

但我想拥有它就像'yyyy-mm-dd'

But I want to have it like 'yyyy-mm-dd'

我在 addElement 方法中尝试了许多选项,如 dateFormat、格式等,但没有任何效果!

I tried many options like dateFormat, format, etc, within the addElement method, but nothing worked!

请帮忙!我被卡住了,在论坛上找不到任何关于此的内容....

Please help! Im stuck and couldn't find anything about that on the forums....

推荐答案

好的,我终于找到了方法:

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.

这篇关于Zend 框架 - JQuery - 日期选择器 - 将日期格式化为 YYYY-mm-dd的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆