Coding / Programming Videos

Post your favorite coding videos and share them with others!

[JavaScript] Date, TimeStamp to Locale Date String – Aaron Lu – Medium

Source link

Using Date.prototype.toLocaleDateString

dateObject.toLocaleDateString([locales [, options]]);

before: 1552800857541
after: 2019/03/17

var now = new Date(
var options = { year: 'numeric', month: 'long', day: 'numeric' };
console.log(now.toLocaleDateString('zh-TW', { year: 'numeric', month: '2-digit', day: '2-digit'}));
// expected output: 2019/03/17

Source link


Leave a Reply

Please Login to comment
Notify of
Translate »