View Single Post
Old 01-14-2023, 04:47 AM  
Mr Pheer
I got bored here.
 
Mr Pheer's Avatar
 
Industry Role:
Join Date: Dec 2002
Location: In your AirBNB
Posts: 20,574
The code is displaying 'Y' as 1969 because the third argument passed to the mktime() function is $today-8 instead of $thisYear.

Here is the corrected code:
Code:
<?php

$today = date("d");
$thisMonth = date("m");
$thisYear = date("Y");
echo date("M d Y", mktime(0,0,0, $thisMonth, $today-8, $thisYear));

?>
This will display the date 8 days ago in the format "Jan 6 2023".
Mr Pheer is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote