thymeleaf中的日期格式化
来源:互联网 发布:朱永棠网络电影 编辑:程序博客网 时间:2024/05/23 11:42
<span th:text="${#dates.format(user.date, ‘yyyy-MM-dd‘)}">4564546</span>
或者
<span th:text="${#dates.format(billingForm.startTime,‘yyyy-MM-dd HH:mm:ss‘)}">4564546</span>
2.在当前的项目中还有这样一种情况,就是无法直接把需要thy表达式的放在标签里,因为他可能是在js里面拼接的。如下:
<script th:inline="javascript"> $(function (){ Date.prototype.Format = function (fmt) { //将蓝括号的这段要放在调用时间的上面, var o = { "M+": this.getMonth() + 1, //月份 "d+": this.getDate(), //日 "h+": this.getHours(), //小时 "m+": this.getMinutes(), //分 "s+": this.getSeconds(), //秒 "q+": Math.floor((this.getMonth() + 3) / 3), //季度 "S": this.getMilliseconds() //毫秒 }; if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)); for (var k in o) if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length))); return fmt; } $.each([[${cctwps}]], function (){ var course = this.course, courseClass = this.courseClass, time = ‘‘; //班级别名,班级地址,开课时间,截止时间 if(course.applyEndDate != null){//报名中 截止报名时间 if(course.statusMark == 1){ time = ‘<span>‘+ ‘<span>‘+course.applyEndDate.substring(0,10)+‘截止报名</span>‘+ ‘</span>‘; }else{ time = ‘<span>‘+ ‘<span>‘+new Date(course.startTime).Format("yyyy-MM-dd hh:mm")+‘开课</span>‘+ ‘</span>‘; } }else{ time = ‘‘; } }); }) </script>这里面course.startTime 就是你要拼接放进去的数据。
如果还有其它方法如果我找到了,会有后续更新。。。
thymeleaf中的日期格式化
阅读全文
0 0
- thymeleaf中的日期格式化
- Thymeleaf表达式语法以及日期格式化
- jstl中的日期格式化
- GridView 中的日期格式化
- 格式化GridView中的日期
- JAVA中的日期格式化
- Jquery中的日期格式化
- javascript中的格式化日期
- jstl中的日期格式化
- jstl中的日期格式化
- .NET 中的数字格式化,日期格式化
- .NET 中的数字格式化,日期格式化
- .NET 中的数字格式化,日期格式化
- .NET 中的数字格式化,日期格式化
- C#中的数字格式化 格式日期格式化
- C#中的数字格式化、格式日期格式化
- Struts2中的日期的格式化
- struts2中的日期格式化输出
- Intellij IDEA 2017 debug断点调试技巧与总结详解篇
- Ansible安装
- 常见端口入侵方法剖析
- ext页面开发常用正则表达式
- MFC复选框CheckBox使用
- thymeleaf中的日期格式化
- 电脑基础使用
- 传值
- linux杂项设备介绍
- 条件随机场详细解析
- 弹性计算服务(ECS)
- 有关于Unity3D中有限状态机简单的思路
- 在linux下使用curl访问 多参数url GET参数问题
- 简明 VIM 练级攻略