gpt4 book ai didi

javascript - jQuery:有没有办法为 jQuery Datepicker 转换日期?

转载 作者:行者123 更新时间:2023-12-02 17:11:41 24 4
gpt4 key购买 nike

我目前在我的网站上使用两个不同的日期选择器,我想只使用 jQuery 的日期选择器。

目前,这是我传递到后端 API 的当前格式: enter image description here enter image description here

但是,我真的很想将日期选择器附加到此输入字段。然而,通过使用 jQuery 日期选择器,我的日期变成了这样,这是发送到后端 API 的无效值:

enter image description here enter image description here

知道如何在日期选择器关闭时将格式“07/16/14”转换为“Wed Jul 16 2014”吗?

最佳答案

您应该能够利用dateFormat 选项中提供的各种选项。完整引用可在 jQueryUI 网站上找到 - http://jqueryui.com/datepicker/#date-formats和 API 站点 - http://api.jqueryui.com/datepicker/#option-dateFormat

DM dd yy 的格式应该可以满足您的需求。

示例代码:$( ".selector").datepicker({ dateFormat: "DM dd yy"});

关于javascript - jQuery:有没有办法为 jQuery Datepicker 转换日期?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24771277/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com