1. function get_str_time(time){
  2. var datetime = new Date();
  3. datetime.setTime(time);
  4. var year = datetime.getFullYear();
  5. var month = datetime.getMonth() + 1 < 10 ? "0" + (datetime.getMonth() + 1) : datetime.getMonth() + 1;
  6. var date = datetime.getDate() < 10 ? "0" + datetime.getDate() : datetime.getDate();
  7. var hour = datetime.getHours()< 10 ? "0" + datetime.getHours() : datetime.getHours();
  8. var minute = datetime.getMinutes()< 10 ? "0" + datetime.getMinutes() : datetime.getMinutes();
  9. var second = datetime.getSeconds()< 10 ? "0" + datetime.getSeconds() : datetime.getSeconds();
  10. return year + "-" + month + "-" + date+" "+hour+":"+minute+":"+second;
  11. }
  1.  

调用get_str_time(时间), 就能把毫秒的时间转换成格式化的 ,转化时间戳的方法的更多相关文章

  1. 带毫秒的字符转换成时间(DateTime)格式的通用方法

    C#自身有更好的方式,Net任意String格式转换为DateTime类型 ====================================================== 原文 ==== ...

  2. Swift3 根据秒数获取视频时长(转换成00:00:00时间格式)以及将时长转换成秒

    直接代码了: /// 秒转换成00:00:00格式 /// /// - Parameter secounds: <#secounds description#> /// - Returns ...

  3. 使用springcloud的feign调用服务时出现的错误:关于实体转换成json错误的介绍

    http://blog.csdn.net/java_huashan/article/details/46428971 原因:实体中没有添加无参的构造函数 fastjson的解释: http://www ...

  4. SetLocalTime API函数设置本地时间(DateTimeToSystemTime函数,把TDateTime转换成TSystemTime)

    procedure setLocalDateTime(Value: TDateTime);var  lSystemDateTime: TSystemTime;begin  DateTimeToSyst ...

  5. VC中如何获取当前时间(精度达到毫秒级)

    标 题: VC中如何获取当前时间(精度达到毫秒级)作 者: 0xFFFFCCCC时 间: 2013-06-24链 接: http://www.cnblogs.com/Y4ng/p/Millisecon ...

  6. C语言如何获得精确到毫秒的时间

    在做测试或性能优化时,经常要知道程序运行的时间,在Linux系统可以使用time命令来计算程序运行运行所消耗的时间,能精确到毫秒,如果要精确到代码块或某个操作运行时所消耗的时间,time命令就不给力了 ...

  7. js中的时间与毫秒数互相转换

    1.js毫秒时间转换成日期时间 var oldTime = (new Date("2012/12/25 20:11:11")).getTime(); //得到毫秒数     //不 ...

  8. Linux下得到毫秒级时间--C语言实现(转-度娘818)

    Linux下得到毫秒级时间--C语言实现 原文链接: http://www.cnblogs.com/nwf5d/archive/2011/06/03/2071247.html #ifdef HAVE_ ...

  9. [转]js中的时间与毫秒数互相转换

    原文地址:http://blog.sina.com.cn/s/blog_77cb836301015icr.html [1]js毫秒时间转换成日期时间   var oldTime = (new Date ...

随机推荐

  1. [UWP]不那么好用的ContentDialog

    ContentDialog是UWP开发中最常用的组件之一,一个体验良好的UWP应用很难避免不去使用它.博客园里也有许多的文章介绍如何来利用ContentDialog实现各种自定义样式的弹窗界面.不过实 ...

  2. three.js 微信小游戏

    最近在 https://classroom.udacity.com/courses/cs291 学习了一些 3D 引擎和 three.js 的知识 把 three.js 弄到微信小游戏里,先随便跑一跑 ...

  3. tomcat 启动报错org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalin

    IDEA tomcat 7.0.53 严重: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed ...

  4. 微信小程序框架与组件

    版权声明:未经博主允许不得转载 前言: 学习微信小程序应该不怎么难吧~下面我来记录一下学习笔记,在学微信小程序的时候,如果你有html+css+javascript的基础,那么你就很快地上手掌握的.下 ...

  5. 基于vue的颜色选择器vue-color-picker

    项目中有用到颜色选择器的童鞋们可以看过来了 关于color-picker的jquery的插件是有蛮多,不过vue组件没有吧,反正我没有找到, 虽然element-ui里面有这个,但是你愿意为了一个小功 ...

  6. Shell-16--函数

    函数的定义和调用放在一起(同一个shell)的好处是不会存在路径的问题:如果功能复杂,则应分开

  7. ajax接口和后台交互

    //定义一个公众处理ajax的方法 function handelAjax(url,method,parm,callback) { $.ajax({ url:url, type:method, dat ...

  8. Hive的union和join操作

    建表语句: create table  tb_in_base (    id  bigint,    devid bigint,     devname string  ) partitioned b ...

  9. android UI:Fragment碎片

    碎片(Fragment) 嵌入与活动中的UI片段,为了合理的分配布局而存在,这是我的简单理解.多用于兼顾手机与平板的UI,也适用于灵活高级的UI制作. Demo 简单的按键切换两片不同的Demo 新建 ...

  10. Django--文件上传和下载,自测试可用

    html <div class="form-group col-sm-offset-2 col-sm-10"> <label for="exampleI ...