Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JavaScript Get Month Name from a Date String</title> </head> <body> <script> // Creating a date object var today = new Date('2021-10-06'); // yyyy-mm-dd // Getting short month name (e.g. "Oct") var month = today.toLocaleString('default', { month: 'short' }); document.write(month); </script> </body> </html>