gpt4 book ai didi

datetime - 使用formatDate的grails文本字段

转载 作者:行者123 更新时间:2023-12-02 15:29:55 25 4
gpt4 key购买 nike

我的gsp页面中有以下文本字段,该文本字段无法按预期工作:

<g:textField name="startTime"
value="${formatDate(date: occurrenceStart ? new Instant(occurrenceStart).toDate() : eventInstance?.startTime, format: 'dd/MM/yyyy hh:mm a')}"
class="datetime" />

我使用的是 here的源代码,但是每次选择日期和时间时,日期都显示为MM / dd / yyyy。我需要在哪里更改格式?

编辑:
通常,我使用Mozilla Firefox来测试我的项目。如果我使用的是Google Chrome浏览器,则在Adavis答案中建议的更改之后,我具有以下格式日期(选择2014年1月12日,上午5:00):

12 / January / 20142014 hh:01 a 05:00 am

如果删除添加的代码,则我具有上述相同的行为,格式为MM / dd / yyyy

最佳答案

在此文件中:setupDatePickers()中的https://github.com/craigburke/google-calendar-grails/blob/master/web-app/js/calendar.js,第60行,您需要将日期格式添加到datetimepicker的默认选项中。见下文...

function setupDatePickers() {
$("input.datetime").datetimepicker({
ampm: true,
stepMinute: 15,
dateFormat: 'dd/MM/yyyy hh:mm a'
});
}

关于datetime - 使用formatDate的grails文本字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21063136/

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