Answer the question
In order to leave comments, you need to log in
How to compare two dates with time and in what format?
Hello. I checked similar questions, read the manual at www.php.net/manual/ru/datetime.diff.php, anyway the question is relevant for me.
In general, to the point. There is a date in the datetime-local format, say 2019-12-02T15:15
I need to add 90 minutes to it and compare it with the time at the moment, whether it is more or less.
Perhaps in a very strange way, I converted the date to a similar form 15:15 12/02/2019
$hdr = strtr($q['date1'], array('T' => ' ')); // вырезаю T
date('H:i d.m.Y', strtotime($hdr.':00')); //подгоняю под формат функции date() и вывожу
Answer the question
In order to leave comments, you need to log in
Easy, categories are subcategories, using advanced custom fields you add name / description fields for categories and display them, when displaying a category, you get child categories and show
$time1 = new \DateTime('2019-12-02T15:15');
$time1->add(new \DateInterval('PT90M'));
echo $time1->format('Y-m-d H:i'), PHP_EOL;
$time2 = new \DateTime();
echo $time2->format('Y-m-d H:i');
var_dump($time1 > $time2);
https://ideone.com/T9vHrL
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question