Json格式日期转换为一般日期
Json日期转换为一般日期:json日期:/Date(1316756746000)/ 转换为2013-09-01格式的
1 //将json格式的时间转换成一般时间
2 function ChangeDateFormat(jsondate) {
3 jsondate = jsondate.replace("/Date(", "").replace(")/", "");
4 if (jsondate.indexOf("+") > 0) {
5 jsondate = jsondate.substring(0, jsondate.indexOf("+"));
6 } else if (jsondate.indexOf("-") > 0) {
7 jsondate = jsondate.substring(0, jsondate.indexOf("-"));
8 }
9 var date = new Date(parseInt(jsondate, 10));
10 var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
11 var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
12 return date.getFullYear() + "-" + month + "-" + currentDate;
13 }
Json格式日期转换为一般日期的更多相关文章
- 简单的分页存储过程,Json格式日期转换为一般日期
简单的分页存储过程 CREATE PROC Paged @pageIndex INT, @pageCount INT OUTPUT, @pageSize INT AS DECLARE @count I ...
- Python将JSON格式数据转换为SQL语句以便导入MySQL数据库
前文中我们把网络爬虫爬取的数据保存为JSON格式,但为了能够更方便地处理数据.我们希望把这些数据导入到MySQL数据库中.phpMyadmin能够把MySQL数据库中的数据导出为JSON格式文件,但却 ...
- webapi返回json格式,并定义日期解析格式
1.webapi返回json格式 var json = config.Formatters.JsonFormatter; json.SerializerSettings.PreserveReferen ...
- python json格式字符串转换为字典格式
不废话,看代码 #_*_ coding:utf- _*_ import os import json course=open('C:\\Users\\ly199\\Desktop\\list.txt' ...
- WebApi 返回小驼峰式 json 格式,并格式化日期
from:http://blog.csdn.net/magiccops/article/details/42969363 屏蔽默认返回xml格式:Global文件加:GlobalConfigurati ...
- MATLAB datenum日期转换为Python日期
摘要 MATLAB datenum时间格式参数众多,本文只简单关注 units 参数,即基准年份和计时度量(天.小时). 命令行演示在 ipython 和 Octave 中进行. 示例1:小时制,基准 ...
- 将JSON格式数据转换为javascript对象 JSON.parse()
<html><body><h2>通过 JSON 字符串来创建对象</h3><p>First Name: <span id=" ...
- json格式的转换为json字符串函数
function toJSON(object){ var type = typeof object; if ('object' == type) { if (Array == object.const ...
- json格式字符串与java.util.Map的互转(借助于jackson.jar)
package com.test.javaAPI.json; /** * json工具类 * * @author Wei * @time 2016年10月2日 下午4:25:25 */ public ...
随机推荐
- 与Eclipse关于"Call Hierarchy"和"Find Reference"功能比较
"Call Hierarchy"功能比较 Eclipse的"Call Hierarchy"可以查看一个Java方法或类成员变量的调用树(caller和calle ...
- 【2006】求N!的精确值
Time Limit: 3 second Memory Limit: 2 MB 对于阶乘函数,即使自变量较小,其函数值也会相当大.例如: 10!=3628800 25!=155112100433309 ...
- [Vue] Create Vue.js Layout and Navigation with Nuxt.js
Nuxt.js enables you to easily create layout and navigation by replacing the default App.vue template ...
- 【solr专题之四】在Tomcat 中部署Solr4.x 分类: H_HISTORY 2014-07-17 16:08 1286人阅读 评论(0) 收藏
1.安装Tomcat (1)下载并解压至/opt/tomcat中 # cd /opt/jediael # tar -zxvf apache-tomcat-7.0.54.tar.gz # mv apac ...
- ios开发transform属性
#import "ViewController.h" @interface ViewController () @property (weak, nonatomic) IBOutl ...
- Java编程思想第四版 *第五章 个人练习
练习3:(1)创建一个带默认构造器(即无參构造器)的类.在构造器中打印一条消息.为这个类创建一个对象.P116 public class Test{ public Test(){ System.out ...
- [SCSS] Organize SCSS into Multiple Files with Partials
Tired of dealing with monolithic CSS files? Are requests for multiple CSS files hurting your perform ...
- 【codeforces 760C】Pavel and barbecue
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
- tcp注意点
tcp注意点 tcp服务器一般情况下都需要绑定,否则客户端找不到这个服务器 tcp客户端一般不绑定,因为是主动链接服务器,所以只要确定好服务器的ip.port等信息就好,本地客户端可以随机 tcp服务 ...
- Qt for Automation
Automation, Automotive, and other industries In addition to improving the generic product offering a ...