It is working as expected. $newdate prints as 1 December 2022 However, if the $tour_date is not the current year, it does not work properly. It is still printing as 1 December 2022. The $newdate prints as 1 December 2022. But it should be 1 December 2023 which is -10 days from 11 December 2023. Any idea, that will work
Tag: date-conversion
new DateTime is not working properly with the future date
I am trying to calculate the differences between 2 dates. The first date is the reservation date, and the second date is the traveler’s birthdate. Format of the $tour_day is 15 December, 202X It works if the reservation date is the current year. However if the reservation date is 2022 or more, than it cannot calculate correctly because is always
Convert PHP date into javascript date format
I have a PHP script that outputs an array of data. This is then transformed into JSON using the json_encode() function. My issue is I have a date within my array and it’s not in the correct JavaScript format. How can I convert this within PHP so it is? Instead of the above for the date I need the equivalent