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,
>     TO_DAYS(date1)-TO_DAYS(date1)               as diff_days,
>     PERIOD_DIFF(date1,date2)                    as diff_months,
>     YEAR(date1) - YEAR(date2)                   as diff_years
>   from MYTABLE
>   where id=$id
>
> I'm not sure what
>   select date1-date2 as date_diff
> returns?
>
> beware of the 2037 limitation using UNIX_TIMESTAMP()
>
> regards
> Jeff
>
>
>
> -----Original Message-----
> From: BlackLord [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, March 22, 2001 5:41 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Date subtraction
>
>
> Hi!
>
> I want to subtract to date times from each other. Like :
>
> '2000 12 01 12:12:12' - '2000 11 10 11:39:59'
>
> Is there any function to do this subtraction or can i do it with MySQL's
> SELECT query ?
>
> Thanks
>
>
>
> --
> 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]
>
>
> --
> 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]
>



-- 
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