2023-02-13

Format date time as YYYY-MM-DD HH:MM:SS

What is a simple way format date time to YYYY-MM-DD HH:MM:SS?

new Date().toLocaleDateString('en-CA') + ' ' + new Date().toLocaleTimeString('zh-CN')

We often need this ISO format string. Is there another way to do it that is simpler?



No comments:

Post a Comment