ToDatetime

 public DateTime JsonDateTimeConvert(string time)
{
//try
//{
if (String.IsNullOrEmpty(time))
{
return DateTime.Now;
}
DateTime dt=DateTime.Parse(time);
return dt;
//IsoDateTimeConverter convert = new IsoDateTimeConverter();
//convert.DateTimeFormat = "yyyy-MM-dd HH:mm:ss.fff";
//string ret = JsonConvert.SerializeObject(time, Formatting.Indented, convert);
//return ret;
//}
//catch (Exception exp)
//{
//return null;
//}
}

FromDatetime

 public string JsonDateTimeConvert(DateTime time)
{
DateTime dt = time;
dt = dt.ToUniversalTime();
TimeSpan ts = dt - DateTime.Parse("1970-01-01");
string result = string.Format("\\/Date({0}+0800)\\/", ts.TotalMilliseconds);
return result;
}

JsonDatetime的更多相关文章

  1. JavaScriptSerializer的日期转换方案

    1.转换后过滤替换(通用) /// <summary> /// 日期转换 /// </summary> /// <param name="str"&g ...

随机推荐

  1. PAT Advanced 1027 Colors in Mars (20 分)

    People in Mars represent the colors in their computers in a similar way as the Earth people. That is ...

  2. HBase(二)——搭建Standalone HBase

    HBase搭建--Standalone HBase 1.搭建方式说明 the setup of a single-node standalone HBase. A standalone instanc ...

  3. Python chardet字符编码的判断

    使用 chardet 可以很方便的实现字符串/文件的编码检测.尤其是中文网页,有的页面使用GBK/GB2312,有的使用UTF8,如果你需要去爬一些页面,知道网页编码很重要的,虽然HTML页面有cha ...

  4. win32 界面 背景图片

    case WM_PAINT: { HBITMAP hbm; BITMAP bminfo; hbm = LoadBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE ...

  5. 爱奇艺免费vip观看地址

    本人qq群也有许多的技术文档,希望可以为你提供一些帮助(非技术的勿加). QQ群:   281442983 (点击链接加入群:http://jq.qq.com/?_wv=1027&k=29Lo ...

  6. CF839E Mother of Dragons 最大团 Bron-Kerbosch算法

    题意简述 给你一个\(n\)个节点的无向图\(G=\{V,E\}\)的邻接矩阵\(g\)和每个点的点权为\(s_i\),且\(\sum_{i=1}^n s_i = K\),要你求出\(\mathrm{ ...

  7. java编写算法题格式(链表和二叉树)

    (1)链表 /** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; ...

  8. __new__与__init__的区别

    __new__  : 控制对象的实例化过程 , 在__init__方法之前调用 __init__ : 对象实例化对象进行属性设置 class User: def __new__(cls, *args, ...

  9. 6353. 【NOIP2019模拟】给(ca)

    题目描述 题解 虫合 由于前几天被教♂育了,所以大力找了一发规律 先把m-1,设f[i][j]表示m≤i,有j个叶子节点的答案 转移显然,也显然是O(n^3)的 把f打出来后长这样: 1 1 1 1 ...

  10. POJ 2112 Optimal Milking ( 经典最大流 && Floyd && 二分 )

    题意 : 有 K 台挤奶机器,每台机器可以接受 M 头牛进行挤奶作业,总共有 C 头奶牛,机器编号为 1~K,奶牛编号为 K+1 ~ K+C ,然后给出奶牛和机器之间的距离矩阵,要求求出使得每头牛都能 ...