Introduction

The conversion among different date and time format is intricate. In this page I am going to summarize and implement it in different languages.

ISO Format

In Python

Example 1

from datetime import datetime

datetime.now().isoformat()
'2019-05-16T12:27:34.694124'

Example 2

datetime.strptime("2020-02-18T16:02:43.957369Z", "%Y-%m-%dT%H:%M:%S.%fZ")

In Javascript

console.log(new Date().toISOString())
2019-05-16T04:58:18.119Z

Javascript Date String

In Javascript

Example 1

console.log(new Date())
Thu May 16 2019 12:54:58 GMT+0800

Example 2

console.log(new Date().toDateString())
Thu May 16 2019

Example 3

console.log(new Date().toGMTString())
Thu, 16 May 2019 05:01:22 GMT

Reference

Library

Documentation