Home>

example

14.02.2022

in

14 Feb. 2022

larn.javascript.ru/datetime

Max Watson2022-02-14 09:21:25
  • Answer # 1

    You can do it like this. The date must be specified in a variablefromDate

    const fromDate= '14.02.2022'.split(".")
    const date= new Date(fromDate[2], fromDate[1] -1, fromDate[0])
    const formatter= new Intl.DateTimeFormat('ru', {
      month: 'short'
    });
    const month= formatter.format(date);
    console.log(`${date.getDate()} ${month} ${date.getFullYear()}`) //Feb 14th 2022
    
                                
                            
  • Answer # 2

    https://qna.habr.com/q/33355

    This should help

    new Date().toLocaleString('ru', { year: 'numeric', month: 'long', day: 'numeric' });

    with today's date it will work. But I get exactly in the format 02/24/2022

    oksana Ткачик2022-02-14 09:36:33