Title: #1507 - Reformat Date - LeetCode JavaScript Solutions
Open Graph Title: #1507 - Reformat Date - LeetCode JavaScript Solutions
X Title: #1507 - Reformat Date - LeetCode JavaScript Solutions
Description: Given a date string in the form Day Month Year, where: Day is in the set {"1st", "2nd", "3rd", "4th"...
Open Graph Description: Given a date string in the form Day Month Year, where: Day is in the set {"1st", "2nd", "3rd", "4th"...
X Description: Given a date string in the form Day Month Year, where: Day is in the set {"1st", "2nd", "3rd", "4th"...
Keywords:
Opengraph URL: https://leetcodejavascript.com/solutions/reformat-date
Domain: leetcodejavascript.com
{"@context":"https://schema.org","@type":"Code","url":"https://leetcodejavascript.com/solutions/reformat-date","name":"#1507 - Reformat Date - LeetCode JavaScript Solutions","description":"Given a date string in the form Day Month Year, where: Day is in the set {"1st", "2nd", "3rd", "4th"...","programmingLanguage":"JavaScript","codeRepository":"https://github.com/JoshCrozier/leetcode-javascript","codeSampleType":"JavaScript","text":"/**\n * @param {string} date\n * @return {string}\n */\nvar reformatDate = function(date) {\n const [_, day, month, year] = date.match(/(\\d+)\\w+\\s+(\\w+)\\s+(\\d+)/);\n return new Date(`${day} ${month} ${year}`).toISOString().split('T')[0];\n};","keywords":"LeetCode 1507, #1507 - Reformat Date, Easy, JavaScript solution","learningResourceType":"Code","isAccessibleForFree":true,"educationalLevel":"intermediate","interactivityType":"mixed"}
| author | LeetCodeJavascript.com |
| og:type | article |
| og:image | https://leetcodejavascript.com/og-image.jpg |
| og:site_name | LeetCode JavaScript Solutions |
| twitter:card | summary_large_image |
| twitter:url | https://leetcodejavascript.com/solutions/reformat-date |
| twitter:image | https://leetcodejavascript.com/og-image.jpg |
| twitter:creator | @joshcrozier |
| theme-color | #1f2937 |
Links:
| LeetCodeJavascript.com | https://leetcodejavascript.com/ |
| Star on GitHub | https://github.com/JoshCrozier/leetcode-javascript |
| Back to all solutions | https://leetcodejavascript.com |
| View on LeetCode | https://leetcode.com/problems/reformat-date/ |
| View on GitHub | https://github.com/JoshCrozier/leetcode-javascript/blob/master/solutions/1507-reformat-date.js |
| String | https://leetcodejavascript.com/tags/string |
| Josh Crozier | https://joshcrozier.com |
Viewport: width=device-width,initial-scale=1
Robots: index, follow