//往往json传过来的时间都是"/Date(1405056837780)/"
//转换需要的方法
String.prototype.ToString = function (format) {
var dateTime = new Date(parseInt(this.substring(6, this.length - 2)));
format = format.replace("yyyy", dateTime.getFullYear());
format = format.replace("yy", dateTime.getFullYear().toString().substr(2));
format = format.replace("MM", dateTime.getMonth() + 1)
format = format.replace("dd", dateTime.getDate());
format = format.replace("hh", dateTime.getHours());
format = format.replace("mm", dateTime.getMinutes());
format = format.replace("ss", dateTime.getSeconds());
format = format.replace("ms", dateTime.getMilliseconds())
return format;
};
//调用
"/Date(1405056837780)/".ToString("yyyy年MM月dd日hh时mm分ss秒");

  结果为:2014年7月11日13时33分57秒

"/Date(1405056837780)/" 时间转换的更多相关文章

  1. Date类型时间转换

    /* 时间转换start */ public static void main(String args[]) { Date nowTime = new Date(); System.out.print ...

  2. [转载]date命令时间转换

    Linux时间戳和标准时间的互转 在LINUX系统中,有许多场合都使用时间戳的方式表示时间,即从1970年1月1日起至当前的天数或秒数.如/etc/shadow里的密码更改日期和失效日期,还有代理服务 ...

  3. 时间转换(字符串转date 年月日时分秒 格式)

    /**     * 时间转换     * @param data     * @return     */    public String getValidDateStr(Date data) {  ...

  4. 【js Date】时间字符串、时间戳转换成今天,明天,本月等文字日期

    作为前端开发攻城师,难免对时间进行各种计算和格式转换,一个js的Date对象统统可以搞定.下例是将一个具体的时间转换成今天.明天.几天之内.本月等文字描述的日期的工具函数,也可以基于它扩展,多应用于网 ...

  5. js Date对象要注意的问题(时间转换)

    1.时间戳和时间对象可以灵活转变: let n = new Date() // 返回的是当前时间对应的国际时间 let nt =n.getTime() let n2 =new Date(nt) con ...

  6. JAVA CST时间 转换成Date

    Mybatis中处理Oracle时间类型是个比较麻烦的问题,特别是需要用到时间做比较的,可参考以下代码与思路: 格式化CST时间 SimpleDateFormat sdf = new SimpleDa ...

  7. [jquery]将当前时间转换成yyyymmdd格式

    如题: function nowtime(){//将当前时间转换成yyyymmdd格式 var mydate = new Date(); var str = "" + mydate ...

  8. MySQL 日期、时间转换函数

    MySQL 日期.时间转换函数:date_format(date,format), time_format(time,format) 能够把一个日期/时间转换成各种各样的字符串格式.它是 str_to ...

  9. java时间类型的转换/获取当前时间/将时间转换成String/将String转换成时间

    对于我的脑子,我已经服气了...写了N遍的东西,就是记不住...既然记不住那就记下来... 利用java获取当前的时间(String类型,年-月-日 时:分:秒) //我要获取当前的日期 Date d ...

随机推荐

  1. [ActionScript 3.0] LocalConnection示例

    下例包含两个 ActionScript 类,这两个类应当编译到两个单独的 SWF 文件中: 在 LocalConnectionSenderExample SWF 文件中,将创建 LocalConnec ...

  2. List<IPoint> to IPointCollection to IPolygon

    IPointCollection 到 IPolygon的转换 IPoint pPoint = new PointClass();            //IPolygon pPolygon1 = n ...

  3. Spring配置项<context:annotation-config/>说明

    配置applicationContext.xml时经常会看到: <context:annotation-config/> 它的作用是隐式地向Spring容器注册AutowiredAnnot ...

  4. (转)c#多线程 Invoke方法的使用

    原文地址:http://www.cnblogs.com/lovko/archive/2008/12/19/1358748.html 在多线程编程中,我们经常要在工作线程中去更新界面显示,而在多线程中直 ...

  5. Oracle 11g新参数USE_LARGE_PAGES与AMM使用 (转载)

    在之前的文章(http://space.itpub.net/17203031/viewspace-774843)中,笔者介绍了如何在Linux 2.6内核中配置HugePage以及AMM与其的不兼容性 ...

  6. php rmdir()删除目录的需要注意的几点

    原文地址:http://www.manongjc.com/article/1316.html php rmdir()函数用于删除目录,但是在使用这个函数删除目录之前,我们必须要做一些判断,首先要判断目 ...

  7. Activity代码结构

    把一个Nova项目中典型的Activity代码结构简单归纳一下,保持代码风格的一致,有助于日常开发效率提升以及日后维护 Class Name     变量 constants   requests   ...

  8. OpenStack Nova 制作 Windows 镜像

    OpenStack Nova 制作 Windows 镜像   windows虚拟机ubuntuimage防火墙云计算 本贴转自http://www.vpsee.com 上次 VPSee 给 OpenS ...

  9. C#中如何判断联系电话的合法性

    string tel = tb_tel.Text.Trim();//联系电话if (!string.IsNullOrEmpty(tb_tel.Text.Trim())){try{//num = Con ...

  10. gcov源码,供学习使用。

    摘自http://www.opensource.apple.com/source/gcc/gcc-5484/gcc/gcov.c /* Gcov.c: prepend line execution c ...