How do I get the 1-day previous date of a dd/mm/yyyy string in PHP?

Advertisements I have a string, for example: $date = "01/04/2022"; I want to get the previous day’s date in dd/mm/yyyy format (i.e., 31/03/2022). How do I proceed? >Solution : You can use Datetime Class of PHP to modify the date. Ex : $date = "01/04/2022"; $dateTime = DateTime::createFromFormat(‘d/m/Y’, $date); $dateTime->modify(‘-1 day’); $previousDate = $dateTime->format(‘d/m/Y’); echo… Read More How do I get the 1-day previous date of a dd/mm/yyyy string in PHP?

the return from the form doest appeare in the backend side of my code

Advertisements I am wokring on a small project to learn more about the request methods on PHP. In which I take the value from a user input and do text transformation on it, then return it to the user. html `<form action="index.php" method="GET"> <input type="text" placeholder="Enter name" name="name"/> <input type="submit" value="Go" name="submit"/> </form>` php `<?php… Read More the return from the form doest appeare in the backend side of my code

Checking if a time range contains another time range in PHP

Advertisements Hi Can you help me in my problem? checking if a time range contains another time range for example I have 2 time range: $nightShiftStart = strtotime("22:00:00 today"); $nightShiftEnd = strtotime("06:00:00 tomorrow"); $overTimeStart = strtotime("21:00:00 today"); $overTimeEnd = strtotime("07:00:00 tomorrow"); if I check if overtime start and end contains night shift schedule it should… Read More Checking if a time range contains another time range in PHP