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?



Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation