W
W
WotanWeb2020-01-19 14:34:23
PHP
WotanWeb, 2020-01-19 14:34:23

Why is there an error in hours when converting php time?

There are dates in this form: 2018-12-26 14:24:12
To convert them to the desired format, I use

date ("d.m.Y h:i:s", strtotime('2018-12-26 14:24:12'))

And the result is: 12/26/2018 02:24:12 .
The question is why 14 hours turned into 02 and how to avoid this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2020-01-19
@WotanWeb

why 14 hours turned into 02

Because 14 hours is 2 hours in 12 hour format.
Specify 24 hour format. Replace h with H.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question