Jim Moseby wrote:
Hi all,
I need to manage some records with dates. mmddyyyy

I'm putting select options breaking the three up in numeric pull

[snip]

For instance, what would you have to do to get the day of the week for a day
66 days prior to the stored date?  If your date was stored in a DATE field,
all you would have to do is:

$result=mysql_query("SELECT DATE_FORMAT(DATE_SUB(`stored_date`, interval 66
days) ,"%W") from tablename where...");
$row=mysql_fetch_row($result);
echo "The day if the week is ".$row[0];

...if your dates are stored in integer fields, how would you easily come
about a similar result?

JM


Um... Just because...

$dayOfTheWeek = date("l", $dateFromDatabase - (66 * 86400));

*assuming by integer fields the OP is talking about unix timestamps*

But you, and a previous poster, do bring up an interesting idea about this. I'd never thought about just how many different things you can do, or might need to do, with a DATE field in the database.

Thanks!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to