One of the main challenges of working with date and time objects is the variety of formats that can be used for representing date and time. For example, most of the common calendar systems use an alphabetical form to represent the three date components:
- Y: Refers to the year, which can display either using the yy (two-digits year, for example, 18) or yyyy (four-digit year, for example, 2018) formats.
- M: Refers to the month. Here there are four methods to display the month:
- m: One-digit month (the first 9 months represented by a single digit, for example, 1 for January, 2 for February, and so on)
- mm: Two-digit month (the first 9 months represented by two digits, for example, 01 for January, 02 for February, and so on)
- mmm: Three-letter abbreviation for a month (for example, Jan for January, Feb for February, and so on)
- mmmm: Full month name (for example...