首页 > 其他分享 >常用设置时间格式

常用设置时间格式

时间:2022-11-01 16:33:16浏览次数:37  
标签:常用 Hour Month Second 设置 date 格式 Day Minute

fromatTime(val){
	const data = new Date(val)
	const Year = date.getFullYear()
	let Month = date.getMonth() + 1
	Month = Month < 10? '0' + Month : Month
	let Day = date.getDate()
	Day = Day < 10? '0' + Day : Day
	let Hour = date.getHours()
	Hour = Hour < 10? '0' + Hour : Hour
	let Minute = date.getMinutes()
	Minute = Minute < 10? '0' + Minute : Minute
	let Second = date.getSeconds()
	Second = Second < 10? '0' + Second : Second
	return Year + '-' + Month + '-' + Day + '' + Hour + ':' + Minute + ':' + Second
}

标签:常用,Hour,Month,Second,设置,date,格式,Day,Minute
From: https://www.cnblogs.com/totopian/p/16848186.html

相关文章

  • etcd(3):常用命令行
    etcdctl常用命令行用户可以使用etcd的命令行工具etcdctl与etcd服务端进行交互。默认情况下,etcdctl使用v2的API,如需要使用v3的API,可以导入如下环境变量:exportETCDCTL_AP......
  • 关于代理的设置
    环境变量设置代理全局设置代理就使用环境变量配置(这里只针对Linux或者Mac)vim/etc/profile--------------------------------------------http_proxy=IP:PORThttps_pr......
  • yml/yaml--文件格式/配置文件--用法/写法
    原文网址:yml/yaml--文件格式/配置文件--用法/写法_IT利刃出鞘的博客-CSDN博客简介说明     YAML 是一种简洁的非标记语言,文件名后缀为.yml,java中经常用它描述......
  • 常用Api返回数据结构封装
    ///<summary>///返回封装///</summary>///<paramname="statusCode"></param>///<returns></returns>public......
  • CentOS7设置时间自动同步
    设置开机自动同步Internet时间,并作定时同步任务1、修改时区rm-rf/etc/localtimeln-s/usr/share/zoneinfo/Asia/Shanghai/etc/localtimevim/etc/sysconfig/clock......
  • yum localinstall 解决本地rpm包的依赖问题,以及yum 命令常用方法
    摘自:https://blog.csdn.net/heshouyou/article/details/66971116 今天在Fedora12上安装VBox的时候遇到一点麻烦,还好yum localinstall帮我轻松的解决这个问题.[Blinux......
  • MySQL InnoDB 行记录格式(ROW_FORMAT)
    1 问题描述公司某游戏日志监控报警,查看日志显示如下错误:Rowsizetoolarge(>8126).ChangingsomecolumnstoTEXTorBLOBorusingROWFORMAT=DYNAMICorROWFORMAT=......
  • 常用的快捷键
    常用的快捷键全选CTRL+A复制CTRL+C粘贴CTRL+V撤销CTRL+Z保存CTRL+S关闭窗口ALT+F4运行Win+R永久删除SHIFT+DELETE打开我的电脑Win+E打开任务管理器CTR......
  • Freeswitch sofia常用命令
     #查看所有已注册用户sofiastatusprofileinternalreg#查看已注册用户1006sofiastatusprofileinternalreg1006sofiastatusprofileinternaluser1006#删除已注......
  • android开发:弹框(AlertDialog)和提示信息Toast字体大小颜色设置
    一、AlertDialog: AlertDialog.Builderbuilder=newAlertDialog.Builder(ReturnActivity.this,android.support.design.R.style.Base_Theme_AppCompat_Dialog_Alert);b......