YYYY-MM-DD formatted date string

node v18.11.0
version: 2.0.0
endpointsharetweet
const now = new Date() const year = now.getFullYear() const month = now.toLocaleString('default', { month: '2-digit' }) const day = now.toLocaleString('default', { day: '2-digit' }) const formattedDate = `${year}-${month}-${day}` console.log(formattedDate)
Loading…

no comments

    sign in to comment