Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript get month string


const today = new Date()
today.toLocaleString('default', { month: 'long' })

// GET DYNAMIC MONTH STRING

const monthtostring = month => new Date(`${month}/01/2032`).toLocaleString('en-US', { month: 'long' })
monthtostring(8) // August

const monthtostring = month => new Date(`${month}/01/2032`).toLocaleString('pt-BR', { month: 'long' })
monthtostring(03) // março
Source by flaviocopes.com #
 
PREVIOUS NEXT
Tagged: #javascript #month #string
ADD COMMENT
Topic
Name
4+8 =