工作中遇到后台给的表格数据里时间是一个13位的时间戳,需要转换成时间显示在表格里, 可以用element-ui表格自带的:formatter函数,来格式化表格内容: // 时间戳转换成时间 // 使用element table组件中的formatter属性,传入一个函数 timestampToTime (row, column) { var date = new Date(row.cjsj) //时间戳为10位需*1000,时间戳为13位的话不需乘1000 var Y = date.getFul
看rocketmq源码的时候发现他们还给时钟封装里一下. /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The A
Date date = new Date();//yyyy-mm-dd hh:mm:ss[.fffffffff] SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss.0"); System.out.println("现在的日期时间是:" + sdf.format(date));; Calendar c = Calendar.getInstance(); // c.setTime(date)
Share 一个昨天写的函数. 目的是求给定的时间是所在月份的第几个礼拜. DELIMITER $$ USE `t_girl`$$ DROP FUNCTION IF EXISTS `weekofmonth`$$ CREATE DEFINER=`root`@`localhost` FUNCTION `weekofmonth`( f_datetime DATETIME ) RETURNS INT(11) BEGIN -- Created by ytt. DECLARE v_result INT; D
二话不说,先上图 实现如上代码: //获取本周第一天 showWeekFirstDay: function () { let Nowdate = new Date(); let WeekFirstDay = new Date(Nowdate - (Nowdate.getDay() - 1) * 86400000); let M = Number(WeekFirstDay.getMonth()) + 1; if (M < 10) { M = "0" + M; } let D = W