MySQL DATE() Function17 Mar 2025 | 1 min read The date() is a MySQL date/time function. It is used to get the date from given date/datetime. SyntaxParameter:expression: date/datetime value to be extracted. ReturnsThis function will return NULL if the expression is not a date or a datetime value. Example 1Output: ![]() Example 2Output: ![]() Next TopicMySQL date/time |
MySQL Date/Time localtime() Function The localtime() is a MySQL date/time function. It is used to get the current date and time. Syntax select localtime(); Returns: This function returns the current date and time. Example 1 Select localtime(); Output: Example 2 Select localtime()+2; Output: TopicMySQL datetime ...
1 min read
MySQL DAYOFWEEK() Function The dayofweek() is a MySQL date/time function. It is used to get the day of the week in numeric. Syntax select dayofweek(date); Parameter: Date: date value for getting a day of the week. Returns: This function returns the weekday index for a date value. Example 1 Select dayofweek('2018-09-26'); Output: Example 2 Select dayofweek('2018-5-12'); Output: TopicMySQL date/time ...
1 min read
MySQL CURDATE() Function The curdate() is a my date/time function. It is used to get the current date. Syntax select curdate(); Parameters NA Returns This function returns the current date. Example 1 Select curdate(); Output: Example 2 Select curdate()+2; Output: TopicMySQL date/time ...
1 min read
MySQL Date/Time timediff() Function The timediff() is a MySQL date/time function. It is used to get the difference from given two time/datetime. Syntax select timediff(time1, time2) Parameter: time1, time2: time values to get the difference Returns: This function returns the difference between two time/datetime values. Example 1 select timediff('01:25:23','12:56:12'); Output: Example 2 select timediff('2018-02-03 12:56:12','2018-10-03 01:25:23'); Output: TopicMySQL datetime ...
1 min read
MySQL DAYNAME() Function The dayname() is a MySQL date/time function. It is used to get the name of the day from the given date. Syntax select dayname('date_name'); Parameter: date_name: date for getting name of day. Returns This function returns the weekday name for a date. Example 1 Select dayname('2018-09-25'); Output: Example 2 Select dayname('2018-09-10'); Output: TopicMySQL date/time ...
1 min read
MySQL Date/Time minute() Function The minute() is a MySQL date/time function. It is used to get the value of minute from given datetime or time. Syntax ect minute(date_value); Parameter: Date_value: datetime or time value for getting minute. Returns: This function returns the minute portion of a date value. Example 1 select minute('10:18:25.000002'); Output: Example 2 select minute('2018-9-28 10:20:25.000002'); Output: ...
1 min read
MySQL CURRENT_DATE() Function The current_date() is a MySQL date/time function. It is used to get the current date. Syntax select current_date(); Parameters NA Returns The current_date() function returns the current date. It will return the current date as a 'YYYY-MM-DD' format if used in a string context. It will return the current date...
1 min read
MySQL Date/Time second() Function The second() is a MySQL date/time function. It is used to get the second portion from the given date/datetime. Syntax select second(date_value); Parameter: date_value : date/datetime value for getting second. Returns: This function returns the second portion of a date value. Example 1 Select second('2018-09-29 01:21:24.000002'); Output: Example 2 select second('02:25:24.000004'); Output: TopicMySQL datetime ...
1 min read
MySQL Date/Time monthname() Function The monthname() is a MySQL date/time function. It is used to get the full month name. Syntax select monthname(date_value); Parameter: date_value : datetime or time value for getting month name. Returns: This function returns the full name of the month for a date. Example 1 Select monthname ('2018-9-28 10:20:25.000002'); Output: Example 2 Select monthname('1995-2-11'); Output: ...
1 min read
MySQL Date/Time makedate() Function The makedate() is a MySQL date/time function. It is used to make the date of the given year and number of days. Syntax select makedate(year, number_of_days); Parameter: Year : 4 digit year to find date Number_of_days : total number of days, should be greater than zero. Returns: This function returns...
1 min read
We request you to subscribe our newsletter for upcoming updates.
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India