Date difference in MySQL

Posted By: Matpal Media - 9:34 AM
We can calculate date difference in MySQL through mysql functions. Here are some examples-

1- Difference between current date and a given date .


SELECT DATEDIFF( NOW( ) ,  '2011-12-12 21:41:24' )

2- Difference between two dates


SELECT DATEDIFF(  '2011-12-13 21:41:24',  '2011-12-12 21:41:24' )

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.