Timestamp day

Hello

I need to do two things.

  1. ) From a unix timestamp, I want to determine whether it is, today, yesterday, day before yesterday, last week, last year.

2.) I have a table which is being outputted in a while loop.

Each row has a timestamp.

Some data is from today, some data is from yesterday and some last year.

How can I add which day it is in my results for e.g

Today
todays data 1
todays data 2
todays data 3
Yesterday
yesterdays data 1
yesterdays data 2
Last Year
last years data 1
last years data 2
last years data 3

http://stackoverflow.com/questions/4780333/get-timestamp-of-today-and-yesterday-in-php

Read there, you’ll want to convert the timestamp; note the bottom example.

You may also have a look in PHP date function as I have always used :slight_smile:

http://www.php.net/manual/en/book.datetime.php