//往往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. sikuli

    1.sikuli和selenium集成问题,用java封装一个方法去操作web页面上的一些无法定位的控件  http://bbs.csdn.net/topics/390720479/ 2.关于Siku ...

  2. mssqlserver 批量插入示例

    public bool DoQuestionSqlBulkCopy(DataTable dtDoQuestion,             string DoQuestionName,         ...

  3. openssl rsa 私钥 PKCS8私钥 公钥

    上文配置好 openssl 运行 => cmd => cd C:\usr\local\ssl\bin => 执行 openssl

  4. ASP.NET MVC开发微信(四)

  5. OC基础(24)

    NSMutableArray基本概念 NSDictionary基本概念 NSMutableDictionary基本概念 常见的结构体 *:first-child { margin-top: 0 !im ...

  6. POJ2001-Shortest Prefixes-Trie树应用

    沉迷WOW又颓了两天orz,暴雪爸爸要在国服出月卡了...这是要我好好学习吗?赶紧来刷题了... OJ:http://poj.org/problem?id=2001 题目大意是求所有字符串里每一个字符 ...

  7. Duilib扩展《01》— 双击、右键消息扩展

    用过duilib的可能会发现,duilib中有些控件没能很好的区分左键.右键等消息.所以根据实际需要,我们需要进行相关区分处理,或者自行扩展. 一. 左键.右键消息区分 我们以CListUI控件来分析 ...

  8. PAT1053. Path of Equal Weight

    //之前一直尝试用vector存储path,但是每次错误后回退上一级节点时不能争取回退,导致探索路径正确,但是输出不正确,用参数num,标记前一个路径点的位置传递参数,就好多了 //其中在输入时就将后 ...

  9. centos系统自动化安装研究

    https://rhinstaller.github.io/anaconda/intro.html https://github.com/rhinstaller/pykickstart/blob/ma ...

  10. idea 14 svn安装

    安装SVN客户端. 打开IDEA 14 File-setting-Version coltorl-Subversion-General 填入安装路径 打开"VCS"菜单项然后点击& ...