<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.4/moment.min.js"></script>
https://momentjs.com/
Format Dates
moment().format('MMMM Do YYYY, h:mm:ss a'); // August 7th 2022, 10:49:18 pm
moment().format('dddd'); // Sunday
moment().format("MMM Do YY"); // Aug 7th 22
moment().format('YYYY [escaped] YYYY'); // 2022 escaped 2022
moment().format(); // 2022-08-07T22:49:18-03:00
Relative Time
moment("20111031", "YYYYMMDD").fromNow(); // 11 years ago
moment("20120620", "YYYYMMDD").fromNow(); // 10 years ago
moment().startOf('day').fromNow(); // a day ago
moment().endOf('day').fromNow(); // in an hour
moment().startOf('hour').fromNow(); // an hour ago
Calendar Time
moment().subtract(10, 'days').calendar(); // 07/28/2022
moment().subtract(6, 'days').calendar(); // Last Monday at 10:49 PM
moment().subtract(3, 'days').calendar(); // Last Thursday at 10:49 PM
moment().subtract(1, 'days').calendar(); // Yesterday at 10:49 PM
moment().calendar(); // Today at 10:49 PM
moment().add(1, 'days').calendar(); // Tomorrow at 10:49 PM
moment().add(3, 'days').calendar(); // Wednesday at 10:49 PM
moment().add(10, 'days').calendar(); // 08/17/2022
Multiple Locale Support
moment.locale(); // en
moment().format('LT'); // 10:49 PM
moment().format('LTS'); // 10:49:18 PM
moment().format('L'); // 08/07/2022
moment().format('l'); // 8/7/2022
moment().format('LL'); // August 7, 2022
moment().format('ll'); // Aug 7, 2022
moment().format('LLL'); // August 7, 2022 10:49 PM
moment().format('lll'); // Aug 7, 2022 10:49 PM
moment().format('LLLL'); // Sunday, August 7, 2022 10:49 PM
moment().format('llll'); // Sun, Aug 7, 2022 10:50 PM