Hi all,
I'm having some problems with timestamp operations. I'm new to PHP and mySQL, so bear with me.
I've got a column in my database, called DATE, of type timestamp, which holds the date in the format 20010416.
I need to do two things:
I need to write a SQL SELECT statement that will return any rows that have a timestamp from the previous Monday, through to the following Sunday. ie:
If the timestamp is 20010415, that date is Sunday the 15th April. I need to get the rows with a date range of Monday the 9th Apr, through to Sunday the 15th. The rows returned has to start on the previous Monday, and end on the Sunday following.
I am having trouble achieving this.
The other thing:
This is simpler, but I'm still stumped. As above, I need to get the previous Monday, but i then need to display that date on the page (therefore pass it into a $var) in a friendly version - ie. 20010416 into 16-Apr-01.
Sorry if this is all a bit much, but I'm completely at a loss, and its the last thing I need to get working before the site I'm working on is complete.
Thanks in advance,
K