Who knows how you can flip a date backwards without using tags and the like?

  • 0
    If I get the property into a function let's say function (date)

    how can I turn it over
    from this format 2020-02-18 to this - & gt; 02/18/2020

    iterate over it with an array, and then replace?
    JavaScript Anonymous, Oct 21, 2020

  • 3 Answers
  • 0
    new Date('2020-02-18').toLocaleDateString() // 18.02.2020

    Well, if you don't want to depend on the user's locale, then

    const [year, month, day] = '2020-02-18'.split('-')

  • 0
    Maybe so

    Jace Lowe

  • 0
    let str = '2020-02-18';
    console.log(str.replace(/^(\d+)-(\d+)-(\d+)$/, `$3.$2.$1`))
    Zachary Russo

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!