Page 1 of 1
Reverse strtotime()
Posted: Sun Mar 18, 2007 11:40 am
by thiscatis
A quick question,
i'm using this code:
Code: Select all
$todays_date = date("Y-m-d");
$today = strtotime($todays_date);
But how do I reverse this.
Go from $today to $todays_date
Posted: Sun Mar 18, 2007 11:49 am
by bokehman
Posted: Sun Mar 18, 2007 11:53 am
by John Cartwright
I'm really confused on what you've posted. I don't know why but I am, so lets go through this quick.
You have a date call, as a string and convert this to a timestamp.
Now, you want to have a timestamp and convert it to a date string?
Why not just do
Code: Select all
date('m-d-Y', time());
//or if you want to use any timestamp
date('m-d-Y', strtotime('+5 days'));
Posted: Sun Mar 18, 2007 12:01 pm
by thiscatis
That was just an example.
What I want to do:
Put all my data in a database with a column active_date set to a prefered date,
The script then first gets today's date, queries the database for all the timestamps in the rows,
compares the results with todays date, only displays the results where today's date > active_date and displays
the the date in US Format YYYY-MM-DD
I hope that makes sense

Posted: Sun Mar 18, 2007 12:15 pm
by feyd
Uh... let the database do all that work.