js格式化格林威治时间
格式化时间:Sat Aug 05 00:00:00 CST 2017
function fermitTime(time){
var now = new Date(time);
var year = now.getFullYear();
var mon = now.getMonth()+1;
var date= now.getDate();
if(mon<10){
mon = '0'+mon;
};
if(date<10){
date = '0'+date;
}
var postDate = year+'-'+mon+'-'+date;
return postDate;
} time="Sat Aug 05 00:00:00 CST 2017"; alert(fermitTime(time));
js格式化格林威治时间的更多相关文章
- 格式化格林威治时间(Wed Aug 01 00:00:00 CST 2012)
1.如果格林威治时间时间是date类型.(这种格式最简单) SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd") ...
- JS把格林威治时间转换为北京标准时间
function fermitTime(time){ var now = new Date(time); var year = now.getFullYear(); ; var date= now.g ...
- JS格式化日期时间的方法
//格式化时间的方法 function format(fmt, date) { var o = { "M+": date.getMonth() + 1, //月份 "d+ ...
- JS 格式化当前时间
Date.prototype.format = function(fmt) { var o = { "M+" : this.getMonth()+1, //月份 "d+& ...
- JS 格式化日期时间
方法一: // 对Date的扩展,将 Date 转化为指定格式的String // 月(M).日(d).小时(h).分(m).秒(s).季度(q) 可以用 1-2 个占位符, // 年(y)可以用 1 ...
- js格式化日期时间
// 对Date的扩展,将 Date 转化为指定格式的String // 月(M).日(d).周(E).小时(h).分(m).秒(s).季度(q) 可以用 1-2 个占位符, // 年(y)可以用 1 ...
- js 格式化时间日期函数小结
下面是脚本之家为大家整理的一些格式化时间日期的函数代码,需要的朋友可以参考下. 代码如下: Date.prototype.format = function(format){ var o = { &q ...
- js格式化时间戳
//js格式化时间戳,转换为时间格式 2017-1-15 4:10:15 function getLocalTime(nS) { var time = new Date(parseInt(nS) * ...
- Java格式化CST时间(mysql date类型)
在从mysql导入数据时候,mysql里的日期是格林威治时间,普通格式化不行,这里总结一下格式化格林威治时间的方法: Date date = new Date(); System.out.printl ...
随机推荐
- Python--os的常见方法
1.os.getcwd()+'/filename'------>相当于在当前运行文件的目录下创建一个以filename命名的文件 2.os.path.realpath(__file__)---- ...
- AtCoder Grand Contest 006 (AGC006) C - Rabbit Exercise 概率期望
原文链接https://www.cnblogs.com/zhouzhendong/p/AGC006C.html 题目传送门 - AGC006C 题意 有 $n$ 个兔子,从 $1$ 到 $n$ 编号, ...
- CodeForces 516A Drazil and Factorial 动态规划
原文链接http://www.cnblogs.com/zhouzhendong/p/8990592.html 题目传送门 - CodeForces 516A 题意 对于一个正整数$x$,$f(x)=x ...
- orleans exception序列化
options.FallbackSerializationProvider = typeof(ILBasedSerializer).GetTypeInfo();
- L1-006 连续因子 (20 分) 模拟
一个正整数 N 的因子中可能存在若干连续的数字.例如 630 可以分解为 3×5×6×7,其中 5.6.7 就是 3 个连续的数字.给定任一正整数 N,要求编写程序求出最长连续因子的个数,并输出最小的 ...
- IDEA创建SpringBoot项目
创建SpringBoot有三种方式: 方式一:(常用方式)
- javascript监听数组变化
, ]; ); , ]; ); , ]; ); ]; , ]; ); ); ); break; } if (inserted) { ob.observeArray(inserted); } // 通知 ...
- 了解一下vue源码中vue 的由来
我们之前提到过 Vue.js 构建过程,在 web 应用下,我们来分析 Runtime + Compiler 构建出来的 Vue.js,它的入口是 src/platforms/web/entry-r ...
- go编译go-gtk,出现invalid flag in pkg-config --libs: -Wl,-luuid提示
go编译go-gtk 使用go编译go-gtk,直接编译会出现错误: pkg-config --cflags -- gdk-2.0 gthread-2.0 pkg-config --l ...
- 浅谈云计算SPI(SaaS、PaaS、IaaS)
The other day, I arrived at the SAP LABS CHINA for interview with my pleasure. That gave me a chance ...