Mysql Year Diff. In ms sql server the datediff function is used to get the difference between two dates in terms of years months days hours minutes etc. Mysql period diff returns the difference between two periods.
From a date and time field of mysql table we can collect the year part by using the function year. For example let s you have two dates. String functions ascii char charindex concat concat with concat ws datalength difference format left len lower ltrim nchar patindex quotename replace replicate reverse right rtrim soundex space str stuff substring translate trim unicode upper numeric functions abs acos asin atan atn2 avg ceiling count cos cot degrees exp floor log log10 max.
String functions ascii char charindex concat concat with concat ws datalength difference format left len lower ltrim nchar patindex quotename replace replicate reverse right rtrim.
Here is the main query to get the year part from mysql date and time field. The return value is in the range of 1000 to 9999 or 0 for zero date. For example let s you have two dates. This function only calculates the date portion from each expression.