1、转换代码

 new Date(item.CreatedDate).Format("yyyy-MM-dd hh:mm")

2、需要拓展的方法

 // 对Date的扩展,将 Date 转化为指定格式的String
// 月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符,
// 年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字)
// 例子:
// (new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423
// (new Date()).Format("yyyy-M-d h:m:s.S") ==> 2006-7-2 8:9:4.18
Date.prototype.Format = function (fmt) { //author: zhengsh 2016-9-5
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;
}

最新文章

  1. 【blade利刃出鞘】一起进入移动端webapp开发吧
  2. asp.net 微信开发失效汇总
  3. Fragment笔记整理
  4. Quartz框架简介
  5. 基于51,人体红外感应和RC522的门禁系统
  6. winform无边框拖动
  7. ASP.NET-FineUI开发实践-16(一)
  8. 【回顾整理】HTML+CSS个的两个实战项目
  9. AngularJS如何给动态添加的DOM中绑定事件
  10. Python IDLE 快捷键
  11. SQL Server :理解BCM页
  12. js框架封装,模拟jQuery封装
  13. 我了解到的新知识之----遇到路由器DNS被篡改我该怎么办?
  14. python之+=与+(转载)
  15. Luogu P4053 [JSOI2007]建筑抢修
  16. Web开发相关笔记 #05# MySQL中文无法匹配
  17. Highlight.js语法突出显示
  18. linux下iostat命令详解
  19. MFC路径层的使用(BeginPath和EndPath函数)
  20. “在引用COM组件时,出现了无法嵌入互操作类型。。。”的错误

热门文章

  1. nodejs hello world (调用文件执行没反应)
  2. MySQl 存储过程+游标
  3. 为什么cp很多小文件非常慢——对cp和rm命令的一些思考
  4. django开发简易博客(三)
  5. Css静态进度条
  6. hdu 2841 Visible Trees
  7. A package manager for Qt
  8. Archive for required library: ‘WebContent/WEB-INF/lib/xxx.jar cannot&n
  9. 数据结构——队列(Queues)
  10. 机器学习笔记(二)- from Andrew Ng的教学视频