Javascript格式化json返回的时间(/Date(1482747413000)/)
//时间处理,类似/Date(1482747413000)/的形式,得到xxx年xx月xx日 11:11:11
function ChangeDateFormat(jsondate) {
jsondate = jsondate.replace("/Date(", "").replace(")/", "");
if (jsondate.indexOf("+") > 0) {
jsondate = jsondate.substring(0, jsondate.indexOf("+"));
}
else if (jsondate.indexOf("-") > 0) {
jsondate = jsondate.substring(0, jsondate.indexOf("-"));
} var date = new Date(parseInt(jsondate, 10));
var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate(); return date.getFullYear()
+ "年"
+ month
+ "月"
+ currentDate
+ "日"
+ " "
+ date.getHours()
+ ":"
+ date.getMinutes()
+ ":"
+ date.getSeconds();
}
Javascript格式化json返回的时间(/Date(1482747413000)/)的更多相关文章
- javascript格式化json显示
// Example usage: http://jsfiddle.net/q2gnX/ var formatJson = function(json, options) { var reg = nu ...
- JS 获取JSON返回的时间值转换为通常格式展示
var date = new Date(parseInt(数据源.slice(6))); //获取到时间 年月日时分秒 var result = date.getFullYear() + '/' ...
- js/javascript format json(js/javascript 格式化json字符串)
// format json obj string function format_json(txt, compress) { var indentChar = ' '; if (/^\s*$/ ...
- 将JSON格式的时间/Date(2367828670431)/格式 转为正常的年-月-日 格式
function formatDate(NewDtime) var dt = new Date(parseInt(NewDtime.slice(6, 19))); var year = dt.getF ...
- asp.net core json返回的时间格式出现T 如何解决
可以在sturap里面 修改配置日期返回的格式 // services.AddMvc(); services.AddMvc().AddJsonOptions(options => { optio ...
- JavaScript 格式化时间
//格式化 yyyy-MM-dd hh:mm:ss function renderTime(date) { if (date == '' || date == null) { return ''; } ...
- java parse 带英文单词的日期字符串 转 date (转化新浪微博api返回的时间)
拂晓风起 专注前端技术cocos2d.js.flash.html5,联系:kenkofox@qq.com.如果读者要找腾讯工作机会,请不吝推荐简历. 博客园 首页 新闻 新随笔 联系 管理 订阅 随笔 ...
- laydate控件后台返回的时间前台格式化
//功能:laydate控件后台返回的时间前台格式化 //参数:laydate控件值 function formatDate(strTime) { if ("" === strTi ...
- javascript 解析ajax返回的xml和json格式的数据
写个例子,以备后用 一.JavaScript 解析返回的xml格式的数据: 1.javascript版本的ajax发送请求 (1).创建XMLHttpRequest对象,这个对象就是ajax请求的核心 ...
随机推荐
- mysql binlog_row_image的选择
其含义为 The default value is full. In MySQL 5.5 and earlier, full row images are always used for both b ...
- linux(十三)__vsftpd服务器
rpm -qa |grep vsftpd yum search vsftpd yum install vsftpd 查看是否已经启动: service vsftpd status 启动: servic ...
- linux(十一)__Apache服务器
查询是否安装了apache rpm -qa |grep httpd yum install httpd 安装 service httpd start 启动 测试Apache服务器 注意:防火墙 ...
- freemarker页面中文乱码
一.前言 简单的记录freemarker遇到的错误问题:ftl页面中文乱码 由于freemarker整合在ssm框架中,所以笔者直接贴配置代码 <beans xmlns="http:/ ...
- AlloyRenderingEngine燃烧的进度条
写在前面 Github: https://github.com/AlloyTeam/AlloyGameEngine HTML 5新增了progress标签,那么再去使用AlloyRenderingEn ...
- HTTP 错误 404.3 - Not Found 由于扩展配置问题而无法提供您请求的页面。如果该页面是脚本 ,请添加处理程序。如果下载文件,请添加 MIME 映射。 IIS站点中添加WCF项目后浏览网站报错解决方法。
vs2013 wcf服务 windows10 家庭中文版 上图中的红色没有出现就按照下面的方法做: 按照上图所示勾选. 刷新上图中你的网站,查看上图右边的内容是否出现,如果出现,再次重新浏览网站,看一 ...
- Git命令
1. 检出项目到本地 git clone git@github.com:michaelliao/gitskills.git 2. 查看当前工作区状态 git status 3. 添加文件或文件夹至版本 ...
- php使用microtime(true)查看代码执行时间
microtime() 函数返回当前 Unix 时间戳和微秒数. 如果带个 true 参数, 返回的将是一个浮点类型 round() 取出小数点后 3 位 $t1 = microtime(true); ...
- android安卓Sqlite数据库实现用户登录注册
看了很多别人写的安卓SQlite数据的操作代码,一点也不通俗易懂,我觉得我写的不错,而且安卓项目也用上了,所以在博客园里保存分享一下!建立一个类 并继承SQLiteOpenHelper public ...
- Vmware虚拟机Devstack安装openstack(All in one)
Vmware虚拟机Devstack安装openstack(All in one) 博客园第一篇博客,先练习一下. 官方文档 环境 Vmware虚拟机 OS : Ubuntu 14.04 Nat网络,D ...