How to change the time to the format when the day is 23 o'clock. For example, when I click on 23 in the datapicker, 11 is shown, but i want to see 23
function onChange(date, dateString) {
console.log(date, dateString);
}
ReactDOM.render(
<Space direction="vertical">
<DatePicker
allowClear
placeholder="укажите дату"
local="ISO 8601"
showTime={{
defaultValue: moment("00:00:00", "HH:mm:ss")
}}
format="YYYY-MM-DD hh:mm:ss"
onChange={onChange}
/>
</Space>,
document.getElementById("container")
);
Lowercase, ie 'h' or 'hh' is used for 12 hour format in momentjs.
Now since you want a 24 hour format, use 'H' or 'HH'. Use format="YYYY-MM-DD HH:mm:ss"
. This should work.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.