Jump to content

[SOLVED] How to show Today/Yesterday instead of date


dudeness3

Recommended Posts

yerp. easy. :) my way:

just make your date variable in the format of date("mdy").
[code=php:0]
if($date == date("mdy")){
$date = "Today"; //add the time bit
}elseif($date == date("mdy", mktime(0,0,0,date("m"),date("d")-1,date("y"))){
$date = "Yesterday"; //add the time bit as well
}else{
$date = $date; //default date...
}
[/code]

hope that helps!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.