0

Hi,
I want to know that how can I get the timestampdiff return as zero instead of null. For example I have a query in which both dates are exactly same but the query returns me null instead of 0. My query is

SELECT (TIMESTAMPDIFF(HOUR,'2012-12-01 11:15:00','2012-12-01 11:15:00'))

And this code is returning me null instead of zero. How can I fix this problem.
Thanks in advance.

3
Contributors
2
Replies
8
Views
4 Years
Discussion Span
Last Post by IIM
0

i am not sure why are you getting null because i tried in my system and it is giving zero.

As from http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_timestampdiff

Returns datetime_expr2 – datetime_expr1, where datetime_expr1 and datetime_expr2 are date or datetime expressions. One expression may be a date and the other a datetime; a date value is treated as a datetime having the time part '00:00:00' where necessary. The unit for the result (an integer) is given by the unit argument. The legal values for unit are the same as those listed in the description of the TIMESTAMPADD() function.

8241b8567a7ba5c2f213b33c15a56b37

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.