RosettaCodeData/Task/Date-format/CoffeeScript/date-format-1.coffee

14 lines
285 B
CoffeeScript
Raw Permalink Normal View History

2015-11-18 06:14:39 +00:00
date = new Date
2013-04-10 16:57:12 -07:00
2015-11-18 06:14:39 +00:00
console.log date.toLocaleDateString 'en-GB',
month: '2-digit'
day: '2-digit'
year: 'numeric'
.split('/').reverse().join '-'
2013-04-10 16:57:12 -07:00
2015-11-18 06:14:39 +00:00
console.log date.toLocaleDateString 'en-US',
weekday: 'long'
month: 'long'
day: 'numeric'
year: 'numeric'