MySQL Function - MySQL - Phptpoint.com

MySQL Function

/ins>

MySQL Predefined Function

There are several predefined library function defined in MySQL library by the help of these functions the performance increases and length of code decreases excessively as we need not to write these complex functions. these predefined functions increases the code re-usability.

Below are the mysql functions that are related to date
sysdate()
current_data()
now()
current_timestamp()
curdate()
datediff()

If we need to find out the difference between two dates the we can use the datediff() function
also suppose if we want to find the current system date the we can use sysdate() function.
several functions of these kind are available in Mysql library.

Function What it Does
sysdate( ) it returns the current date of the system.
Output : 2013-05-04 16:36:58
current_data( ) it also returns the current date of the system
Output : 2013-05-04
now( ) it returns current date, current time with fraction of seconds and the time zone fom GMT.

Output : 2013-05-04 16:36:58

current_timestamp( ) it returns current date, current time with fraction of seconds and the time zone fom GMT
Output : 2013-05-04 16:46:54
curdate( ) it returns current date, current time with fraction of seconds and the time zone fom GMT
Output : 2013-05-04
datediff( ) it Returns the number of days between two dates.
Output : 4