//时间格式化
Date.prototype.format = function (format) {
var o = {
"M+": this.getMonth() + 1, //month
"d+": this.getDate(), //day
"h+": this.getHours(), //hour
"m+": this.getMinutes(), //minute
"s+": this.getSeconds(), //second
"q+": Math.floor((this.getMonth() + 3) / 3), //quarter
"S": this.getMilliseconds() //millisecond
} if (/(y+)/.test(format)) {
format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
} for (var k in o) {
if (new RegExp("(" + k + ")").test(format)) {
format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
}
}
return format;
} function formatData(str, regexp) {
// 转换日期格式
str = str.replace(/-/g, '/'); // "2010/08/01";
// 创建日期对象
var date = new Date(str);
return date.format(regexp);
} formatData(data[i].create_time, 'yy年MM月dd日 hh:mm')

js时间格式化(yy年MM月dd日 hh:mm)的更多相关文章

  1. vue-cli 利用moment.js转化时间格式为YYYY年MM月DD日,或者是YYYY-MM-DD HH:MM:SS 等格式

    1.在mian.js引入moment import moment from 'moment' Vue.prototype.$moment = 'moment' 2. 在main.js 设置全局过滤器 ...

  2. 在rdlc 中 显示成 yyyy年MM月dd日

    在rdlc 中  显示成  yyyy年MM月dd日, 采用: =First(Format(Fields!添加时间.Value,"yyyy年MM月dd日")  )

  3. java 和js 时间 格式化(yyyy-MM-dd HH:mm:ss) 以及获取当前时间

    1.js var myDate = new Date(); myDate.getYear(); //获取当前年份(2位) myDate.getFullYear(); //获取完整的年份(4位,1970 ...

  4. js 时间格式化 (兼容safari)

    js 时间格式化,兼容IE8和safari浏览器. function formatDate(date, fmt, near, type) { var dateStr = date; if (!date ...

  5. js时间格式化函数(兼容IOS)

    * 时间格式化 * @param {Object} dateObj 时间对象 * @param {String} fmt 格式化字符串 */ dateFormat(dateObj, fmt) { le ...

  6. 时间戳显示为多少分钟前,多少天前的JS处理,JS时间格式化,时间戳的转换

    var dateDiff = function (timestamp) { // 补全为13位 var arrTimestamp = (timestamp + '').split(''); for ( ...

  7. js时间格式化函数,支持Unix时间戳

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/ ...

  8. 表单序列化json字符串和js时间格式化

    js时间格式化 new Date().format("时间格式") Date.prototype.format = function(fmt) { var o = {        ...

  9. java为啥计算时间从1970年1月1日开始

    http://www.myexception.cn/program/1494616.html ————————————————————————————————————————————————————— ...

随机推荐

  1. BZOJ4004: [JLOI2015]装备购买

    总之就是线性基那一套贪心理论直接做就好了. 然而加强数据后很卡精度的样子. 于是重点在于这个特技:在整数模意义下搞. #include<cstdio> #include<algori ...

  2. js007-函数表达式

    js007-函数表达式 本章内容 1.函数表达式的特征 2.使用函数实现递归 3.使用闭包定义私有量 定义函数的方式有两种:一:函数声明,二:函数表达式 函数声明: function function ...

  3. Tomcat 开发web项目报Illegal access: this web application instance has been stopped already. Could not load [org.apache.commons.pool.impl.CursorableLinkedList$Cursor]. 错误

    开发Java web项目,在tomcat运行后报如下错误: Illegal access: this web application instance has been stopped already ...

  4. PHP ob系列函数详解

    一. 相关函数简介:    1.Flush:刷新缓冲区的内容,输出.    函数格式:flush()    说明:这个函数经常使用,效率很高.    2.ob_start :打开输出缓冲区    函数 ...

  5. Django笔记-数据库操作(多对多关系)

    1.项目结构 2.关键代码: data6.settings.py INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.auth', ' ...

  6. C# 对象 序列化 XML

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.I ...

  7. c语言中time相关函数

    工作中遇到的函数: int seed = time(NULL); srand(seed); signal(SIGINT, stop); signal(SIGUSR1, sig_usr1); 搜time ...

  8. 管理员必备的Linux系统监控工具

    管理员必备的Linux系统监控工具 #1: top - 进程活动 top提供一个当前运行系统实时动态的视图, 也就是正在运行进程.在默认情况下,显示系统 中CPU使用率最高的任务,并每5秒钟刷新一次. ...

  9. thinkphp的url地址区分大小写?

    在默认情况下: 在访问url地址的时候, 其中的 Action类名 即: 模块名称 是区分大小写的. (只有模块名, 即控制器名称) 可以根据设置 'URL_CASE_INSENSITIVE' =&g ...

  10. 该不该用inline-block取代float? inline和float的区别?

    该不该用inline-block取代float? 请看这篇文章引用: jtyjty99999的博客 让块级元素 水平排列的通常方式是float, 但是float可能会带来很多意外的问题 可以考虑用in ...