Skip to content

Instantly share code, notes, and snippets.

@hyeonseok
Created December 13, 2019 03:40
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
// https://twitter.com/umaar/status/1205249225962995717
Object.getOwnPropertyNames(Date.prototype)
.filter(name => name.startsWith('to'))
.map(method => `${method}: ${(new Date())[method]()}`)
/*
0: "toUTCString: Fri, 13 Dec 2019 03:39:10 GMT"
1: "toLocaleString: 2019. 12. 13. 오후 12:39:10"
2: "toLocaleDateString: 2019. 12. 13."
3: "toLocaleTimeString: 오후 12:39:10"
4: "toDateString: Fri Dec 13 2019"
5: "toTimeString: 12:39:10 GMT+0900 (대한민국 표준시)"
6: "toISOString: 2019-12-13T03:39:10.263Z"
7: "toJSON: 2019-12-13T03:39:10.263Z"
8: "toSource: (new Date(1576208350263))"
9: "toString: Fri Dec 13 2019 12:39:10 GMT+0900 (대한민국 표준시)"
10: "toGMTString: Fri, 13 Dec 2019 03:39:10 GMT"
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment