> can I used the value from that variables to compare with another 
> date value? Say another date value I will use is also retrieved 
> from a field in table which is in Date data type as well.

When you get into this stuff, it all starts getting a lot more complicated.

If you want to compare two fields, make sure they're in the same format.

Basically, make sure you use four digit years and two digit months and
days to create your birthday fields, so they look like (for example, with
today's date, 20010115 instead of 2001115 - that second one could really 
be anything).

If you're sure you're storing the birthdays properly, you can then cut
the strings up when you pull them out of the database, the first 4 chars
are the year, the next two make the month (regardless of the actual month,
this way it'll be "01" not "1"), then the day. 

Do that for both of the dates.

Now, you can use the mktime() command to turn them into unix tiumestamps.

$unixtimeme   = mktime(myhour, myminute, mysecond, mymonth, myday, myyear);
$unixtimethem = mktime(theirhour, theirminute, theirsecond, theirmonth,
theirday, theiryear);

Now, a unix timestamp is the number of seconds from 00:00:01, Jan 1, 1970.

You can figure out the difference in seconds between the two timestamps.

Divide it by (24*3600), which is the number of seconds in a day, and there
you have the number of days between the dates.

Incidentally, if you want to find the number of days between your birthDAYS,
then you'll want to substitute in a specific year in the mktime() statements
above, as you'll otherwise end up with the number of days between your exact
DATES of birth.

Jason

-- 
Jason Murray
[EMAIL PROTECTED]
Web Design Team, Melbourne IT
Fetch the comfy chair!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to