Re: [PHP] Date Subtraction

2002-12-23 Thread Justin French
okay, this is just me thinking out loud... none of this is tested... basically, - take the string - get rid of the last 3 chars (eg .75) - split on ' days, ' - split the 2nd half on ':' - multiply each bit (days, hrs, mins) by the appropriate no of seconds - add it all together to get a number

Re: [PHP] Date Subtraction

2002-12-23 Thread Marco Tabini
I don't think you can use strtotime in that case. However, assuming that your data is properly formatted every time, you can use a simple function like this (I'm doing it from memory, so it might not actually work): Hope this helps. Cheers, Marco -- php|architect - The Magazine

Re: [PHP] Date subtraction

2001-03-23 Thread BlackLord
thanks for your help. ""Jeff Armstrong"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Do it in MySQL = Fast > Don't fiddle in PHP = waste of your time. > > Look into the following: > > select > UNIX_TIMESTAMP(date1)-UNIX_TIMESTAMP(date1) as diff_secs, >

RE: [PHP] Date subtraction

2001-03-23 Thread Jeff Armstrong
Do it in MySQL = Fast Don't fiddle in PHP = waste of your time. Look into the following: select UNIX_TIMESTAMP(date1)-UNIX_TIMESTAMP(date1) as diff_secs, TO_DAYS(date1)-TO_DAYS(date1) as diff_days, PERIOD_DIFF(date1,date2)as diff_months, YEAR(dat

Re: [PHP] Date subtraction

2001-03-22 Thread almir
PERIOD_DIFF(P1,P2) or convert them both tu unix_time(p1) - unix_time(p2) then you can have seconds and format them as you want almir ""BlackLord"" <[EMAIL PROTECTED]> schrieb im Newsbeitrag 99dcs5$cbh$[EMAIL PROTECTED]">news:99dcs5$cbh$[EMAIL PROTECTED]... > Hi! > > I want to subtract to date tim