
Product
Socket for Jira Is Now Available
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.
支持任意格式组合的日期格式化、逆转、校验,日期格式标准参考C#。
支持的格式化标记:yyyy、yy、MM、M、dd、d、HH、H、mm、ss。
var date = new Date(2020, 11, 31, 13, 56, 57)
var date1 = new Date(2020, 1, 3, 3, 4, 5)
new DateAny('yyyy-MM-dd HH:mm:ss').format(date);
= '2020-12-31 13:56:57'
new DateAny('yyyy-M-d H:mm:ss').format(date1);
= '2020-2-3 3:04:05'
new DateAny('dd/M/yyyy H:mm:ss').format(date1);
= '03/2/2020 3:04:05'
new DateAny('yy年的M月dd日 H点mm分').format(date1);
= '20年的2月03日 3点04分'
new DateAny().format(date);
= '2020-12-31'
new DateAny().toDate('2020-12-31');
= (Date) 2020-12-31 00:00:00
new DateAny('yyyy-MM-dd HH:mm:ss').toDate('2020-12-31 13:56:57');
= (Date) 2020-12-31 13:56:57
new DateAny('yyyy-M-d H:mm:ss').toDate('2020-2-3 3:04:05');
= (Date) 2020-02-03 03:04:05
new DateAny('dd/M/yyyy H:mm:ss').toDate('03/2/2020 3:04:05');
= (Date) 2020-02-03 03:04:05
new DateAny('yy年的M月dd日 H点mm分').toDate('20年的2月03日 3点04分');
= (Date) 2020-02-03 03:04:00
new DateAny('yyyy').toDate('2020');
= (Date) 2020-01-01 00:00:00
new DateAny('yyyy-MM-dd HH:mm:ss').check('2020-12-31 13:56:57');
= true
new DateAny('yyyy-M-d H:mm:ss').check('2020-2-3 3:04:05');
= true
new DateAny('dd/M/yyyy H:mm:ss').check('03/2/2020 3:04:05');
= true
new DateAny('yy年的M月dd日 H点mm分').check('20年的2月03日 3点04分');
= true
FAQs
Date formatting and parsing like C#. C#风格的日期格式化与逆转.
We found that date-any demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.