1.common.js
export function formatTime(data){
var d = new Date(data);
function doTime(d){
if(d<10){
d='0'+d;
}
return d;
}
var times=d.getFullYear() + '-' + doTime((d.getMonth() + 1)) + '-' + doTime(d.getDate()) + ' ' + doTime(d.getHours()) + ':' + doTime(d.getMinutes()) + ':' + doTime(d.getSeconds());
return times;
}
 
2.页面引用
import {formatTime} from '../../common/timedeal';
<dd>{tData.lastEditTime ? formatTime(tData.lastEditTime) : '-'}</dd>

React时间组件(时分秒补0)页面全局引用的更多相关文章

  1. Swift3.0 iOS获取当前时间 - 年月日时分秒星期

    Swift3.0 iOS获取当前时间 - 年月日时分秒星期func getTimes() -> [Int] { var timers: [Int] = [] // 返回的数组 let calen ...

  2. input内强制保留小数点后两位 位数不足时自动补0

    input内强制保留小数点后两位 位数不足时自动补0 小数点后位数超出2位时进行四舍五入 需引入jquery包 1.11.2版本 1 function xiaoshu(x) 2 { 3 var f = ...

  3. Java数字格式化输出时前面补0

    Java数字格式化输出时前面补0 星期日 2014年11月30日|  分类: Java     /** * 里数字转字符串前面自动补0的实现. * */ public class TestString ...

  4. 如果 date_field = TRUNC(date_field) 就说明时分秒为0(也就是不包含),否则就包含时分秒

    如果 date_field = TRUNC(date_field) 就说明时分秒为0(也就是不包含),否则就包含时分秒

  5. Java Date 时分秒置0

    Date now = new Date(); Calendar cal1 = Calendar.getInstance(); cal1.setTime(now); // 将时分秒,毫秒域清零 cal1 ...

  6. sqlserver 中,如何将getdate()时间的时分秒固定为00:00:00或者忽略不要

    在使用getdate()时,时间会实时刷新,那么我们就要再查询的时候就需要精确到毫秒后三位,非常难受,那么为了解决这个问题我们可以通过以下几种方法进行固定或者去掉毫秒 1.将毫秒固定为00:00:00 ...

  7. MySQL C#连接ySQL保存当前时间,时分秒都是0,只有日期

    原因:MySQL的字段格式是:date 解决: 1.把 字段格式 改为 datetime 2.映射 的字段类型 也要改为 datetime

  8. sqlserver 获取时间年月日时分秒

    转自:http://blog.itpub.net/14766526/viewspace-1156100/ select GETDATE() as '当前日期',DateName(year,GetDat ...

  9. C#:获取时间年月日时分秒格式

    //获取日期+时间 DateTime.Now.ToString();            // 2008-9-4 20:02:10 DateTime.Now.ToLocalTime().ToStri ...

随机推荐

  1. 快速入门 WePY 小程序【转】

    一.WePY介绍 WePY 是 腾讯 参考了Vue 等框架对原生小程序进行再次封装的框架,更贴近于 MVVM 架构模式, 并支持ES6/7的一些新特性. 二.WePY 使用 1.WePY的安装或更新都 ...

  2. Linux解压缩命令tar

    tar -c: 建立压缩档案-x:解压-t:查看内容-r:向压缩归档文件末尾追加文件-u:更新原压缩包中的文件 这五个是独立的命令,压缩解压都要用到其中一个,可以和别的命令连用但只能用其中一个.下面的 ...

  3. oracle 优化or 更换in、exists、union all几个字眼

    oracle 优化or 更换in.exists.union几个字眼.测试没有问题! 根据实际情况选择相应的语句是.假设指数,or全表扫描,in 和not in 应慎用.否则会导致全表扫描.  sele ...

  4. [译] 理解 LSTM(Long Short-Term Memory, LSTM) 网络

    本文译自 Christopher Olah 的博文 Recurrent Neural Networks 人类并不是每时每刻都从一片空白的大脑开始他们的思考.在你阅读这篇文章时候,你都是基于自己已经拥有 ...

  5. Javadoc转换chm帮助文档的四种方法总结

    1) 将现有的 html 文件集(比如 api) 制作成chm 文档 http://www.blogjava.net/lishunli/archive/2010/01/07/308618.html 我 ...

  6. 20模板方法模式TemplateMethod

    一.什么是模板方法模式 Template Method模式也叫模板方法模式,是 行为模式之一,它把具有特定步骤算法中的某些 必要的处理委让给抽象方法,通过子类继承对抽 象方法的不同实现改变整个算法的行 ...

  7. Elasticsearch学习之有用博客

    推荐阅读:1.阿里:https://elasticsearch.cn/article/61712.滴滴:http://t.cn/EUNLkNU3.腾讯:http://t.cn/E4y9ylL4.携程: ...

  8. react+mobx 编写 withStoreHistory 装饰器

    主要作用是向store里面注入一个history对象,方便story里面的函数调用 function withStoreHistory(storeName) { if (!storeName) ret ...

  9. react 中的绑定事件

    handleOpen = (e)=> { this.setState({ open: true }) } <Button color='primary' onClick={this.han ...

  10. hibernate11--Criteria查询

    public class EmpTest { Session session =null; Transaction transaction=null; @Before public void befo ...