[PHP] Re: subtracting dates...

2003-08-02 Thread Paul Chvostek
On Sat, Aug 02, 2003 at 08:30:34PM +0100, John Ryan wrote: > > In mySQL, I store dates as -MM-DD, a standard DATE type. It stores users > date of births. I need to calculate in a PHP script, the users age from this > DOB. I get a PHP date in the same format as the mySQL and subtract, which > re

[PHP] Re: subtracting dates...

2003-08-02 Thread Craig Roberts
Another idea (slightly simpler)... how about using mktime(); to create a timestamp from your date info, and subtract that from the current timestamp - leaving (i think) the person's age in seconds... Then just do some math... hmm... is that really simpler? well it seemed it when i started typing

[PHP] Re: subtracting dates...

2003-08-02 Thread John Ryan
yeah, i was thinking that before i decided to post to the newsgroup. i thought there was some simple way of doing it and id be wasting my time. obviosuly not "Craig Roberts" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Try something along the lines of > > if($current_MM < $MM) {

[PHP] Re: subtracting dates...

2003-08-02 Thread Craig Roberts
Try something along the lines of if($current_MM < $MM) { $age = $calculatedage - 1; } you'll also need to do something like this with the day of the month if the user's bday is in the current month. at least... i think that works out :$ Craig Roberts "John Ryan" <[EMAIL PROTECTED]> wrote in

[PHP] Re: Subtracting dates in php

2003-06-30 Thread Shivanischal A
try http://www.phpclasses.org -shiva "Mike Mannakee" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Anyone know of an easy way to add or subtract dates in php the way you can > in mysql? Easier, that is, than coding the logic by hand? This seems like > a total pain. > > Mike >