View Single Post
Old 01-31-2007, 05:27 AM  
sexjoe
Registered User
 
Join Date: Nov 2005
Posts: 19
Quote:
Originally Posted by mrthumbs View Post
Is there a quick way to determine if a certain date is Tomorrow or Yesterday?
function whichDay($d)
{
if (date('dmY',time()+86400)==date('dmY',$d)) return 't';
if (date('dmY',time()-86400)==date('dmY',$d)) return 'y';
if (date('dmY',time())==date('dmY',$d)) return 'n';
return '';
}

returns t for tomorow, y for yesterday, n for same day and empty string for others...
param must be an unix timestamp, for conversion see PHP mktime function...
sexjoe is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote