Search code examples
javascriptdatedatetimeluxon

Can I get a day and a month in DD MM formats from Luxon library?


Now I can get a day and a month in format 7/6/2019. But I need something like this 07/06/2019. For now, I didn't find a method which returns me a day/month in my desirable format.


Solution

  • From the docs, consider the following:

    console.log(luxon.DateTime.local().toFormat('MM/dd/yyyy')); //07/06/2019
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/build/global/luxon.min.js"></script>