Welcome aboard! We are happy you are here and wish you good net-raft!
$DAY = date("d") - 21; // date("d") is current day of date, 21 is your day of record
if ($DAY == 0 ) {
$dateformat = "created: Today";
}
if ($DAY == 1 ) {
$dateformat = "created: " . $DAY . " day ago";
}
if ($DAY > 1 && $DAY <= 31) {
$dateformat = "created: " . $DAY . " days ago";
}
$MONTH = date("m") - 9; // date("m") is current month of date, 9 is your month of record
if ($MONTH == 1 ) {
$dateformat = "created: " . $MONTH . " month ago";
}
if ($MONTH > 1 ) {
$dateformat = "created: " . $MONTH . " months ago";
}
$YEAR = date("Y") - 2016; // date("Y") is current year of date, 2016 is your year of record
if ($YEAR == 1 ) {
$dateformat = "created: " . $YEAR . " year ago";
}
if ($YEAR > 1 ) {
$dateformat = "created: " . $YEAR . " years ago";
}
The most helpful PHP solutions