//时间转换成时间戳
function DateToUnix(string) {
var f = string.split(' ', 2);
var d = (f[0] ? f[0] : '').split('-', 3);
var t = (f[1] ? f[1] : '').split(':', 3);
var time = (new Date(
parseInt(d[0], 10) || null,
(parseInt(d[1], 10) || 1) - 1,
parseInt(d[2], 10) || null,
parseInt(t[0], 10) || null,
parseInt(t[1], 10) || null,
parseInt(t[2], 10) || null
)).getTime() / 1000
return time;
}
//GMT时间格式转换成字符串
function GMTToStr(time) {
let date = new Date(time)
let Str = date.getFullYear() + '-' +
(date.getMonth() + 1) + '-' +
date.getDate() + ' ' +
date.getHours() + ':' +
date.getMinutes() + ':' +
date.getSeconds()
return Str
}

//时间转换成GMT格式
function parserDate(date) {
var t = Date.parse(date);

if(!isNaN(t)) {
return new Date(Date.parse(date.replace(/-/g, "/")));
} else {
return new Date();
}
};

最新文章

  1. 关于配置Spring框架的多个propertyConfigurer的问题
  2. The Skins of the Substance
  3. js图片放大镜
  4. RHEL5.8使用yum安装X Window System
  5. 李洪强 - C语言8-Scanf函数
  6. Jquery使用ajax以及angularjs 动态模板加载并进行渲染
  7. Flask框架学习笔记(API接口管理平台 V2.0)
  8. 多控制器之UIApplication
  9. 理解CSS中的三种选择器>+~
  10. 一点BPXA的思考
  11. iOS状态栏颜色
  12. Sqoop是一款开源的工具,主要用于在HADOOP(Hive)与传统的数据库(mysql、oracle...)间进行数据的传递
  13. Vertica对于所计算的时间SQL声明大全
  14. React-Native 之 Modal介绍与使用
  15. Django web框架-----Django templates模板
  16. USM-V1.0
  17. 介绍HTTP协议的传输过程
  18. 码云 使用 汉化 GitHub
  19. python Django 项目创建
  20. 安装好kali要做的事

热门文章

  1. [Javascript] Deep Search nested tag element in DOM tree
  2. libyuv库的使用
  3. 解决MyEclipse开启后总是不停的在Update index
  4. HDU1846(巴什博奕)
  5. 求int型数据在内存中存储时1的个数
  6. xcode Automatic signing is unable to resolve an issue with the "ShowCar-IOS" target's entitlements
  7. Vue.js和Nodejs的关系
  8. Python 3.x 判断 dict 是否包含某个键
  9. BZOJ 4742 DP
  10. 134. Gas Station leetcode