Date Format Specification Sample Contracts

Angular json stringify date format
Date Format Specification • March 29th, 2021

The modern webdeveloper's platform Introduction In modern web application, JSON is widely used as communication format between server side and client side. However, JSON do not specify the format of date object. General Agreement ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) is a general agreement for exchange format of date object. JavaScript Date Object The above is a way to create a date object in browser environment. Time zone and locale dependent By Default, browser would use the time zone and locale to display date in browser. i.e. var now = new Date(); console.log(now.toString()); Result: Sun Jun 30 2019 23:18:34 GMT+0800 (China Standard Time) The some method in the date object in browser are timezone and locate dependent. var now = new Date(); now.getHours() result: 23 ISO Format (Time zone and locale independent) As mention above, ISO Date String Format is a general agreement format in JSON format. var now = new Date() console.log(now.toISOString()); result: 2019-06-30T15:55:46.936Z JSO