java - JSP:在 a 中将日期格式设置为“yyyy-MM-dd h:mm a”日期时间选择器的字段
问题描述
<div class="col-xs-12 col-sm-6 col-md-3">
<label for="appointment_date" class="required" style="margin-left:30px">Appointment Date: <span class="blue">*</span></label>
<input id="appointment_date" name="appointment_date" type="text" class="form-control" data-datetimepicker="" required style="margin-left:30px;width: 190px;">
</div>
modified.js 页面如下
$('#appointment_date').datetimepicker({
controlType: 'select',
oneLine: true,
timeFormat: 'hh:mm TT',
showSecond: false,
showMillisec: false,
showMicrosec: false,
showTimezone: false
});
有人可以帮助我以“yyyy-MM-dd h:mm a”的模式获取日期吗?
我尝试了以下方法但没有奏效:
<div class="col-xs-12 col-sm-6 col-md-3">
<label for="appointment_date" class="required" style="margin-left:30px">Appointment Date: <span class="blue">*</span></label>
<fmt:formatDate pattern="yyyy-MM-dd h:mm a" type="date" value="${appointment_date}" var="FormattedDate"/>
<input id="appointment_date" name="appointment_date" type="text" class="form-control" data-datetimepicker="" required value="${FormattedDate}" style="width: 190px;">
</div>
解决方案
推荐阅读
- json - futurebuilder 和 http json 的颤振错误
- azure - 在 Azure 数据工厂中使用服务主体/应用程序进行 OAuth2 身份验证
- docker - docker compose 已更改目录权限
- c# - Azure Functions 中的依赖注入无法为类型化的 HttpClient 调用配置委托?
- postgresql - Cloud SQL - PostgreSQL - 由于缺少超级用户权限,导入失败
- database - 第三方 API 集成 - 如何构建数据库
- dafny - 在归纳数据类型中定义字典顺序
- javascript - WebPack 5 将 CSS 和 JS 组合成一个 JavaScript 文件
- php - 照片在上传时旋转。PHP ImageMagick
- swift - 是否可以在 Swift 中添加多个触觉来一个接一个地播放?