格式化时间
发布日期:2021-10-16 12:04:52 浏览次数:10 分类:技术文章

本文共 2167 字,大约阅读时间需要 7 分钟。

getFormatData(time) {        if (time === undefined || time === '') {
return '' } let currentDate = new Date(time); let year = currentDate.getFullYear() + '年'; let month = this.getTwoNum(currentDate.getMonth() + 1) + '月'; let date = this.getTwoNum(currentDate.getDate()) + '日'; return year + month + date; }, getFormatDataYMDHM(time) { if (time === undefined || time === '') {
return '' } let currentDate = new Date(time); let year = currentDate.getFullYear() + '-'; let month = this.getTwoNum(currentDate.getMonth() + 1) + '-'; let date = this.getTwoNum(currentDate.getDate()) + ' '; let hour = this.getTwoNum(currentDate.getHours()) + ':'; let minute = this.getTwoNum(currentDate.getHours()); return year + month + date + hour + minute; }, getFormatDataMDHMS(time) { if (time === undefined || time === '') {
return '' } let currentDate = new Date(time); let month = this.getTwoNum(currentDate.getMonth() + 1); let date = this.getTwoNum(currentDate.getDate()); let hour = this.getTwoNum(currentDate.getHours()); let minute = this.getTwoNum(currentDate.getHours()); let seconds = this.getTwoNum(currentDate.getSeconds()); return month + date + hour + minute + seconds; }, getFormatDataYMD(time) { if (time === undefined || time === '') {
return '' } let currentDate = new Date(time); let year = this.getTwoNum(currentDate.getFullYear()) + '-'; let month = this.getTwoNum(currentDate.getMonth() + 1) + '-'; let date = this.getTwoNum(currentDate.getDate()) + ''; return year + month + date; }, getFormatDataYMD2(time) { if (time === undefined || time === '') {
return '' } let currentDate = new Date(time); let year = currentDate.getFullYear() + '/'; let month = ('0' + (currentDate.getMonth() + 1)).slice(-2) + '/'; let date = ('0' + (currentDate.getDate())).slice(-2); return year + month + date; },

转载地址:https://blog.csdn.net/snow51/article/details/80660511 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:RN 样式篇 Shadow 阴影效果
下一篇:RN 组件 ScrollView

发表评论

最新留言

网站不错 人气很旺了 加油
[***.192.178.218]2024年03月20日 17时38分43秒

关于作者

    喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!

推荐文章

php dns更新,php_mzdns: 站群,大量域名 通过 dns 服务商 api 批量添加 ip 工具。你懂的~ 基于 mzphp2 框架。... 2019-04-21
jdk 1.8 java.policy,JDK1.8 导致系统报错:java.security.InvalidKeyException:illegal Key Size 2019-04-21
php linux权限,Linux权限详细介绍 2019-04-21
典型环节的matlab仿真分析,典型环节的MATLAB仿真.doc 2019-04-21
Php contenttype类型,各种类型文件的Content Type 2019-04-21
php使用redis持久化,redis如何持久化 2019-04-21
php7.1解压包安装,【Swoole】php7.1安装swoole扩展 2019-04-21
linux centos删除安装的包,CentOS yum认为已删除的软件包仍在安装中 2019-04-21
酒店管理系统c语言带注释,酒店管理系统--C语言版.pdf 2019-04-21
c语言 实现sizeof功能,C语言简单实现sizeof功能代码 2019-04-21
c语言sin函数近似值,用泰勒公式求sin(x)的近似值 2019-04-21
c 语言登录系统源代码,c语言源代码---------------个人图书管理系统 2019-04-21
android线程通信方式,Android 主线程和子线程通信问题 2019-04-21
cps1 cps2 android,图文教程:CPS1和CPS2模拟器使用 2019-04-21
在线设计 html5 表单,html5注册表单制作-表单制作-小程序表单制作 2019-04-21
android小闹钟课程设计,《小闹钟》教学设计 2019-04-21
mysql文件系统_MySQL文件系统先睹为快(1) 2019-04-21
nums在python_程序找到一对(i,j),其中nums [i] + nums [j] +(i -j)在Python中最大化?... 2019-04-21
jquery后台内容管理_教育平台项目后台管理系统:课程内容模块 2019-04-21
grouping函数 mysql_sql聚合函数有哪些 2019-04-21