Michael Stassen said:
>
> Gabriel Alessandria wrote:
>
>> I am a user of Microsoft Sql Server and use very much the function
>> Datediff (interval, fecha1, fecha2) to extract differences between two
>> dates, in years, days, months, hours, etc
>>
>> I am a beginner with MySql and i can't see the way to do this function
>> .. How can I extract for example difference of hours between two given
>> dates .. someone help me please ?
>>
>> Thanks in advance
>
> Not quite sure what it means to get the difference between two dates in
> months or hours, but mysql does have a DATEDIFF function:
>
> DATEDIFF(expr,expr2)
>    DATEDIFF() returns the number of days between the start date expr and
> the end date expr2. expr and expr2 are date or date-and-time
>    expressions. Only the date parts of the values are used in the
>    calculation.
>
> For more date functions, see the manual:
>
>    <http://www.mysql.com/doc/en/Date_and_time_functions.html>
>
> Michael
>
For finergrain accuracy:
(UNIX_TIMESTAMP(TIStop)-UNIX_TIMESTAMP(TIStart))/60
This gets difference in minutes.

William R. Mussatto, Senior Systems Engineer
Ph. 909-920-9154 ext. 27
FAX. 909-608-7061



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to