js转换 /Date(1464671903000)/ 格式的日期的方法
转换成:2016-07-11
function getFDate(date) {
var d = eval('new ' + date.substr(1, date.length - 2));
var ar_date = [d.getFullYear(), d.getMonth() + 1, d.getDate()];
for (var i = 0; i < ar_date.length; i++) ar_date[i] = dFormat(ar_date[i]);
return ar_date.join('-');
}
function dFormat(i) {
return i < 10 ? "0" + i.toString() : i;
}
转换成:2016-07-11 15:00:28
function getFDate(date) {
var d = eval('new ' + date.substr(1, date.length - 2));
var ar_date = [d.getFullYear(), d.getMonth() + 1, d.getDate()];
var ar_time = [d.getHours(), d.getMinutes(), d.getSeconds()];
for (var i = 0; i < ar_date.length; i++) ar_date[i] = dFormat(ar_date[i]);
for (var i = 0; i < ar_time.length; i++) ar_time[i] = dFormat(ar_time[i]);
return ar_date.join('-')+' '+ar_time.join(':');
}
function dFormat(i) {
return i < 10 ? "0" + i.toString() : i;
}
js转换 /Date(1464671903000)/ 格式的日期的方法的更多相关文章
- JS转换/Date(-28800000)/格式
去除/Date() if (value.includes('/Date')) { var re = /-?\d+/; value = re.exec(value); value = new Date( ...
- javascript时间戳转换成指定格式的日期
//时间戳转换成指定格式的日期DateTool.IntDatetimeTo = function(time, format){ var testDate = new Date(time); ...
- js转换Date日期格式
有时候做项目会用到js的date日期格式,因为Date()返回的格式不是我们需要的, Date()返回格式: Thu Mar 19 2015 12:00:00 GMT+0800 (中国标准时间) 而我 ...
- js new Date()参数格式
最近在写页面使用new Date()获取时间戳在ie浏览器中测试发现无效:后来发现是参数格式问题, new Date()参数格式如下: 1.用整数初始化日期对象 var date1 = new Dat ...
- JSON.stringify转换Date不正确的解決方法
JSON.stringify转换Date不正确的原因:国际时区(UTC)和中国时区(GMT)的原因,东八区+8等于国际时区. 解决方法,重新Es5的Date.prototype.toJSON方法,代码 ...
- MySql-时间格式转换之转换为时分秒格式的日期
select date_format(create_datetime,'%Y-%m-%d %k:%i:%s') from busi_repairitem_category MySQL毫秒值和日期的指定 ...
- JS如何将CST格式的日期转换为制定格式String
<html> <body> <script type="text/javascript"> var d = new Date() dateFor ...
- js 时间戳转特定格式的日期
var Tools = {}; Tools.formatDate = function (fmt,timestamp) { if(timestamp){ var date = new Date(par ...
- js转换/Date(........)/
eval('new ' + (datetime.replace(/\//g, ''))); 好记性不如烂笔头,记下以备后用.
随机推荐
- ASP.NET WEB API的服务托管(Self-HOST)
如果我们想对外发布RESTful API,可以基于ASP.NET来构建Restful APIs,但需要部署IIS吗?答案是不必.你可以把它托管到一个Windows Service.具体如何把WEB A ...
- Leetcode | N-Queens I & II
N-Queens I The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no ...
- CentOS源列表
vi /etc/yum.repos.d/CentOS-Base.repo CentOS 5: # CentOS-Base.repo # # The mirror system uses the con ...
- 使用mutt+msmtp在Linux命令行界面下发邮件
mutt命令执行了却发送不了邮件, 搜索了一会才明白原来是mutt需要一个发信的程序, msmtp刚好是一个不错的选择. 1. apt-get install mutt msmtp (安装过程中会弹出 ...
- 1. Nginx
参考: http://www.darrenfang.com/2014/02/install-php-with-nginx-on-ubuntu/ 安装: apt-get install python ...
- HashTable的典型用法以及参考实例
Get-ADComputer -Identity "cnhzpd-f7sc83x" | select -property @{name="computername&quo ...
- The P4 Language Specification v1.0.2 Parser
<p4规范>解析器部分详解 p4解析器是根据有限状态机的思想来设计的. 解析器中解析的过程可以被一个解析图(parser graph)所表示,解析图中所表示的某一个状态(或者说,在P4语言 ...
- ExtJS笔记5 Components
参考 :http://blog.csdn.net/zhangxin09/article/details/6914882 An Ext JS application's UI is made up of ...
- Grid组件 列头居中
在grdMain组件中的 class中设置“ x-grid-title-center ”
- C++ 中static 使用大全
/// 静态全局变量 :只能在当前cpp中访问到 static int s_global = 0; void funcA() { /// 静态局部变量 (函数静态变量) 初始化过一次就不会 ...