php question: today Yesterday Tomorow

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mrthumbs
    salad tossing sig guy
    • Apr 2002
    • 11702

    #1

    php question: today Yesterday Tomorow

    Is there a quick way to determine if a certain date is Tomorrow or Yesterday?
  • sexjoe
    Registered User
    • Nov 2005
    • 19

    #2
    Originally posted by mrthumbs
    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...

    Comment

    Working...