|
Posted by Rik Wasmus on 10/14/07 10:44
On Sun, 14 Oct 2007 12:36:13 +0200, bill <nobody@spamcop.net> wrote:
> (Don't froth at the mouth Jerry, this IS a PHP question - sort of <g>)
>
> I have a SQL column with date format. In my PHP script I need to do
> simple math on it, eg how many days past the date in the SQL record are
> we now.
Well, it could be solved quite easily in MySQL....
SELECT
something,
datecolumn,
DATEDIFF(datecolumn,CURDATE())
FROM table
> Do I need to convert it to a timestamp in order to do the math, or is
> there an easier way ?
Otherwise it's just a string, because PHP has no 'date' type. So either
split it into components or indeed convert it to a timestamp (which would
be easiest).
--
Rik Wasmus
Navigation:
[Reply to this message]
|