Jump to content

Recommended Posts

Hi.  I made a visitor log, and for the 'last visit' column, I want it to say 'today' or 'yesterday' if the last visit was today or yesterday.  The only problem is, I don't know how to tackle this beast.

 

I could put day, month, and year into their own variables and compare that way, but then I have the headache of worry about the 1st of the month (to where yesterday would actually be a high value).

 

I know I can use strtotime() but I don't know how I'd go about telling if a date is "yesterday" compared to today using that method.

 

Any ideas?  I save my dates as MMDDYYHHMMSS in my table but I can manipulate it as necessary.

 

Thanks ahead of time.

Hi.  I made a visitor log, and for the 'last visit' column, I want it to say 'today' or 'yesterday' if the last visit was today or yesterday.  The only problem is, I don't know how to tackle this beast.

 

I could put day, month, and year into their own variables and compare that way, but then I have the headache of worry about the 1st of the month (to where yesterday would actually be a high value).

 

I know I can use strtotime() but I don't know how I'd go about telling if a date is "yesterday" compared to today using that method.

 

Any ideas?  I save my dates as MMDDYYHHMMSS in my table but I can manipulate it as necessary.

 

Thanks ahead of time.

 

ok well I figured it out, i used gregoriantojd(); to convert to the julian day format and just took the difference, so if the difference was 0, it's today, if the difference is 1, it's yesterday, pretty simple.  php keeps surprising me with all these handy built in functions ;D

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.