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

Spring Elasticsearch Operations

Object oriented programming concepts (OOPs)

Spring Boot and Vaadin : Filtering rows in Vaadin Grid