MySQL DATE_FORMAT() Function17 Mar 2025 | 2 min read The date_format() is a MySQL date/time function. It is used to get the date in specified format. SyntaxParameter:Date: date to be formatted Format_mask: format to be applied in date, following is the list of all the formats.
Example 1Output: ![]() Example 2Output: ![]() Example 3Output: ![]() Example 4Output: ![]() Example 5Output: ![]() Next TopicMySQL date/time |
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 Subtime() Function The subtime() is a MySQL date/time function. It is used to get the time/datetime which is subtracted by certain intervals. Syntax select subtime(start_value, time); Parameter: Start_value: time/datetime by which interval is to be subtracted. Time: time in which interval is to be subtracted. Returns This function returns the time/datetime which...
1 min read
MySQL Date/Time timestamp() Function The timediff() is a MySQL date/time function. It is used to convert the expression into datetime/time. Syntax select timestamp(expression, [interval]) Parameter: Expression : time/datetime value to be converted Interval : it is optional, it is added into time value Returns: This function returns a datetime value. Example 1 select timestamp('2018-10-03'); Output: Example 2 select timestamp('2018-10-03...
1 min read
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 DAY() Function The day() is a MySQL date/time function. It is used to get the day from the given date. Syntax select day('date_value'); Parameter: date_value: date for getting day. Returns This function returns the day of the month (a number from 1 to 31) given a date value. Example 1 Select day('2018-09-25'); Output: Example 2 Select day('2018-09-10'); Output: ...
1 min read
MySQL DATE_ADD() Function The date_add() is a MySQL date/time function. It is used to get the date in which some date/datetime intervals are added. Syntax select date_add(date, interval value unit); Parameter: Date: date in which interval will be added Value: date/time intervals Unit: type of interval which are as following: Unit Compatibility MICROSECOND 4.1.1+ SECOND 3.2.3+ MINUTE 3.2.3+ HOUR 3.2.3+ DAY 3.2.3+ WEEK 5+ MONTH 3.2.3+ QUARTER 5+ YEAR 3.2.3+ SECOND_MICROSECOND 4.1.1+ MINUTE_MICROSECOND 4.1.1+ MINUTE_SECOND 4.1.1+ HOUR_MICROSECOND 4.1.1+ HOUR_SECOND 4.1.1+ HOUR_MINUTE 3.2.3+ DAY_MICROSECOND 4.1.1+ DAY_SECOND 3.2.3+ DAY_MINUTE 3.2.3+ DAY_HOUR 3.2.3+ YEAR_MONTH 3.2.3+ Returns This function will return...
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 time_format() Function The time_format() is a MySQL date/time function. It is used to format the time in specified given format_mask. Syntax select time_format(time, format_mask) Parameter: Time: time to be format Format_mask: format to be applied on time following are the list of options VALUE DESCRIPTION %f Microseconds (000000 to 999999) %f is available starting in...
1 min read
MySQL ADDDATE() Function The adddate() is a MySQL date/time function. It is used to get the date in which some time/date intervals are added. Syntax select adddate(date, interval value unit ); Or select adddate(date, days); Parameters: Date: date to be added in intervals Days: number of days to be added in date Value: value of...
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