【每日一包0018】fecha
[github地址:https://github.com/ABCDdouyae...]
fecha
比moment.js更加轻量级的时间解析和格式化包
format
用法:format(<Date Object|String|timestamp>, <String Format>)
返回:string
const fecha = require('fecha');
fecha.format(new Date('2018','3','23','12','0','0'), 'YYYY-MM-DD HH-mm-ss dddd');
//2018-04-23 12-00-00 Monday
fecha.format(12312312, 'YYYY/MM/DD HH-mm-ss dddd');
//1970/01/01 11-25-12 Thursday
parse
用法:format(String, <String Format>)
返回:<Date Object>
fecha.parse('February 3rd, 2014', 'MMMM Do, YYYY');
// 2014-02-02T16:00:00.000Z
fecha.parse('10-12-10 14:11:12', 'YY-MM-DD HH:mm:ss');
//2010-12-10T06:11:12.000Z
| Token | Output | |
|---|---|---|
| Month | M | 1 2 ... 11 12 |
| MM | 01 02 ... 11 12 | |
| MMM | Jan Feb ... Nov Dec | |
| MMMM | January February ... November December | |
| Day of Month | D | 1 2 ... 30 31 |
| Do | 1st 2nd ... 30th 31st | |
| DD | 01 02 ... 30 31 | |
| Day of Week | d | 0 1 ... 5 6 |
| ddd | Sun Mon ... Fri Sat | |
| dddd | Sunday Monday ... Friday Saturday | |
| Year | YY | 70 71 ... 29 30 |
| YYYY | 1970 1971 ... 2029 2030 | |
| AM/PM | A | AM PM |
| a | am pm | |
| Hour | H | 0 1 ... 22 23 |
| HH | 00 01 ... 22 23 | |
| h | 1 2 ... 11 12 | |
| hh | 01 02 ... 11 12 | |
| Minute | m | 0 1 ... 58 59 |
| mm | 00 01 ... 58 59 | |
| Second | s | 0 1 ... 58 59 |
| ss | 00 01 ... 58 59 | |
| Fractional Second | S | 0 1 ... 8 9 |
| SS | 0 1 ... 98 99 | |
| SSS | 0 1 ... 998 999 | |
| Timezone | ZZ | -0700 -0600 ... +0600 +0700 |
【每日一包0018】fecha的更多相关文章
- 【每日一包0005】arr-flatten
github地址:https://github.com/ABCDdouyae... arr-flatten 将多维数组展开成一维数组 文档地址:https://www.npmjs.com/packag ...
- 【每日一包0011】pad
[github地址:https://github.com/ABCDdouyae...] pad 给字符串的左右加padding,也可以用于删减字符串两端 用法:pad(str, length, opt ...
- 【每日一包0015】gradient-string
[github地址:https://github.com/ABCDdouyae...] gradient-string 用于在终端打印出好看的渐变文字 普通用法 console.log(gradien ...
- 【每日一包0001】is-sorted
github地址:https://github.com/ABCDdouyae... is-sorted 用于判断数组是否被排序了 文档地址:https://www.npmjs.com/package/ ...
- 【每日一包0003】kind-of
github地址:https://github.com/ABCDdouyae... kind-of 判断数据类型用法:kind-of(date)返回:string 数据类型 January undef ...
- 【每日一包0008】arr-diff
[github地址:https://github.com/ABCDdouyae...] arr-diff 多个数组比较,过滤出第一个数组独有的内容 用法:arr-diff(arr1, arr2, ar ...
- 【每日一包0009】group-array
[github地址:https://github.com/ABCDdouyae...] group-array 对数组里面的多项按照指定的key进行整合 用法:group-array(arr, key ...
- 【每日一包0012】to-camel-case,to-no-case,to-space-case
github地址:https://github.com/ABCDdouyaer/a_pack_per_day_NO.1 to-camel-case 将被其他符号分割的字符串转换为驼峰形式的字符串 用法 ...
- 【每日一包0002】array-first
github地址:https://github.com/ABCDdouyae... array-first 获取数组的第一项或者前几项 文档地址:https://www.npmjs.com/packa ...
随机推荐
- iOS补位动画、沙漏效果、移动UITableViewCell、模拟贪吃蛇、拖拽进度等源码
iOS精选源码 JHAlertView - 一款黑白配色的HUD之沙漏效果 继承UIButton的自定义按钮SPButton 用递归算法实现iOS补位动画 iOS 长按移动UITableViewCel ...
- Seikimatsu Occult Tonneru(网络流,状态数(建不建边)不多时,可考虑直接进行枚举
http://acm.hdu.edu.cn/showproblem.php?pid=4309 总结:边可存东西时,可新建一个点x连接u.v,x再连向汇点: #include<iostream&g ...
- day15-接口类
# 一.接口类的作用是规范它的子类,跟后面学习的接口没关系. from abc import abstractmethod,ABCMeta class Pay(metaclass=ABCMeta): ...
- jQuery性能优化与技巧
1.使用最新版本的jQuery类库 jQuery的每一个新的版本都会较上一版进行Bug修复和一些优化,同时也会包含一些创新,所以建议使用最新版本的jQuery来提高性能,需要注意的是在更换版本之后,要 ...
- gpio 的配置
1.时钟使能 B引脚RCC时钟脉冲启动.|(或)表示只要第三个为1就行. 也可以写为RCC_APB2ENR | = 0X0008; 2.配置GPIO的输出模式以及速度 3 . 如果是 0号引脚:GP ...
- iOS炫酷动画图案、多种选择器、网络测速、滑动卡片效果等源码
iOS精选源码 对网络进行测速 自实现大标题,配合原生骨架屏demo 简单方便的pickerVIew记录数据 LZPickerView 科技风绘制组件,简单快速"画"出炫酷图案 R ...
- CMOS
CMOS是Complementary Metal Oxide Semiconductor(互补金属氧化物半导体)的缩写.它是指制造大规模集成电路芯片用的一种技术或用这种技术制造出来的芯片,是电脑主板上 ...
- linux下如何查看服务器的硬件配置信息
性能测试时一定要确定测试环境和的硬件配置.软件版本配置,保证和线上一致,才更接近真实环境. 那么linux下如何查看服务器的硬件配置信息?? 一.查看cpu信息 1.所有信息 lscpu [root@ ...
- VSTO自动安装、卸载工具
使用本工具,不需要制作VSTO外接程序安装包,就可以把你的作品自动安装到其他电脑. 用法:下载VSTO_Setup.rar,解压缩,然后把你开发好的Debug文件夹和VSTO_Setup.exe一起发 ...
- 1076 Wifi密码 (15 分)
题目:传送门 下面是微博上流传的一张照片:“各位亲爱的同学们,鉴于大家有时需要使用 wifi,又怕耽误亲们的学习,现将 wifi 密码设置为下列数学题答案:A-1:B-2:C-3:D-4:请同学们自己 ...