How To Format Dates In MUI DateTime Picker
React
06/02/2023
The inputFormat
prop allows you to specify a format for the MUI Datetime picker. By default, it uses the American date format of month/day/year
. To change it to day/month/year
, enter the following:
JSX
<DateTimePicker inputFormat="DD/MM/YYYY hh:mm A" />
The letters in the datetime format are case sensitive.
The capital A
at the end is a placeholder for AM/PM (capitalized). If you didn't quite find what you came for, I highly recommend checking out the documentation of Moment.js on the many formatting possibilities.