Re: [PHP] Calculating difference between two days

2006-06-15 Thread afan
Thanks Ted. Very helpfull. -afan > On Wed, June 14, 2006 11:45 am, [EMAIL PROTECTED] wrote: >> I need to calculate no. of days between two dates, actually between >> date stored in DB and today's date. > > If you want to do this via mysql, see: > >

Re: [PHP] Calculating difference between two days

2006-06-15 Thread tedd
On Wed, June 14, 2006 11:45 am, [EMAIL PROTECTED] wrote: > I need to calculate no. of days between two dates, actually between > date stored in DB and today's date. If you want to do this via mysql, see:

Re: [PHP] Calculating difference between two days

2006-06-14 Thread Richard Lynch
On Wed, June 14, 2006 11:45 am, [EMAIL PROTECTED] wrote: > I need to calculate no. of days between two dates, actually between > date > stored in DB and today's date. Almost for sure your best answer is actually in your SQL engine with something like date_subtract in MySQL. PHP's date functions a

Re: [PHP] Calculating difference between two days

2006-06-14 Thread afan
Thanks for all your, very usefull examples. -afan > Shouldn't be too difficult in PHP. > >$yesterday = date("m/d/y", mktime(0,0,0,date("m"), date("d") - 1, > date("y"))); > $today = date("m/d/y"); > > $secondsdiff = strtotime($today) - strtotime($yesterday); > $minutesdiff = $secondsd

Re: [PHP] Calculating difference between two days

2006-06-14 Thread tg-php
Shouldn't be too difficult in PHP. \n"; echo "Minutes difference: $minutesdiff\n"; echo "Hours difference: $hoursdiff\n"; echo "Days difference: $daysdiff\n"; ?> And if you want a larger example to play with, here's something I did a couple years ago (forgive the word wrapping and any unr

Re: [PHP] Calculating difference between two days

2006-06-14 Thread D. Dante Lorenso
[EMAIL PROTECTED] wrote: I need to calculate no. of days between two dates, actually between date stored in DB and today's date. Does anybody has an example I can use? Your database will have this function. In PostgreSQL: SELECT data_column - NOW() AS date_diff; There are similar funct

Re: [PHP] Calculating difference between two days

2006-06-14 Thread Brad Bonkoski
You could just parse the dates out and feed them to mktime(), subtract the difference between the two (in seconds) and use that to determin the number of days... Something like: [EMAIL PROTECTED] wrote: Hi, I need to calculate no. of days between two dates, actually between date stored in