时间格式化
2015-12-01 10:39
375 查看
(new Date(data.book.otherPublishDate)) .format("yyyy年MM月") /** * 时间对象的格式化; */ Date.prototype.format = function(format) { /* * eg:format="yyyy-MM-dd hh:mm:ss"; */ 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 ChangeDate(str) { //解决ie不兼容问题
var t = str
var a = t.replace(/-/g, "/");
return a;
}
相关文章推荐
- 每天一个linux命令(14):which命令
- jdbc获取insert主键
- Android-DialogFragment对话框之登录
- LVS+Keepalived实现高可用负载均衡
- crontab 定时任务
- 使用Glup.JS优化JS、CSS、图片,压缩合并
- 关于Activity的四种启动模式
- composer使用
- 每天一个linux命令(13):tail 命令
- Caffe C++API 提取任意一张图片的特征系列二----MemoryData
- 支付账户:appid\mch_id(微信支付商户号)\API密钥\Appsecret
- Java读书笔记十二(Java中的代码块)
- VC 如何使程序运行后自己删除自己
- 架构-项目管理-jenkins
- cmd命令行字符编码修改
- 【curator】KeeperErrorCode = Unimplemented for /zookeeper/crud
- 收集微信里的图像处理中常用的图像库
- iOS 数字转汉子 等特殊字符串
- CentOS7 安装 swoole
- 多线程技术 NSThread & NSOperation & GCD