//往往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. Dubbo中对Spring配置标签扩展

    Spring提供了可扩展Schema的支持,完成一个自定义配置一般需要以下步骤: 设计配置属性和JavaBean 编写XSD文件 编写NamespaceHandler和BeanDefinitionPa ...

  2. SecureCRT的背景和文字颜色的修改

    options->;session options->;emulation->;terminal选择linux(相应的服务器系统)ansi color 打上钩options-> ...

  3. isPowerOfTwo

    //Given an integer, write a function to determine if it is a power of two. public class isPowerOfTwo ...

  4. 【原】rsync的详细参数

    rsync参数的具体解释如下: -v, --verbose 详细模式输出-q, --quiet 精简输出模式-c, --checksum 打开校验开关,强制对文件传输进行校验-a, --archive ...

  5. No data in the view dba_hist_undostat (文档 ID 1558157.1)

    APPLIES TO: Oracle Database - Enterprise Edition - Version 10.2.0.1 to 11.2.0.3 [Release 10.2 to 11. ...

  6. php文件删除unlink()详解

    请记住从PHP文件创建的教训,我们创建了一个文件,名为testFile.txt . $myFile = "testFile.txt"; $fh = fopen($myFile, ' ...

  7. 用js控制选项卡的隐藏与显示

    通过使用ul和div来,借助于jquery来实现选项卡的显示与隐藏 <form action="" method="post"> <div&g ...

  8. Fiddler抓包工具的使用

    下载 自行去官网下载 http://www.telerik.com/fiddler 配置Fiddler 1.打开Fiddler, Tools-> Fiddler Options -> HT ...

  9. Linux下程序对拍_C++

    此博客需要付费才阅读,因为该博客实用性十分强,且十分容易理解 若需购买请联系博主,联系方式戳这 http://www.cnblogs.com/hadilo/p/5932395.html 主要介绍如何在 ...

  10. com学习(四)2——用 ATL 写第一个组件(vs2003)

    步骤2.1:建立一个解决方案. 步骤2.2:在 该解决方案中,新建一个 vc++ 的 ATL 项目.示例程序叫 Simple2,并选择DLL方式,见图一.图二. 图一.新建 ATL 项目 图二.选择非 ...