MySQL DATEDIFF() Function17 Mar 2025 | 1 min read The datediff() is a MySQL date/time function. It is used to get the difference between two date values. SyntaxParameter:date1 & date2 : date's for calculating the difference. ReturnsThis function returns the difference in days between two date values. Example 1Output: ![]() Example 2Output: ![]() Next TopicMySQL date/time |
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
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 From_days() Function The from_days() is a MySQL date/time function. It is used to get the date of the given number of days. Syntax select from_days(numeric_day); Parameter: Numeric: value to convert in date. Example 1 Select from_days(756982); Output: Example 2 Select from_days(456982); Output: TopicMySQL date/time ...
1 min read
MySQL Date/Time last_day() Function The last_day() is a MySQL date/time function that accepts date or datetime value only. It is used to get the last day of the given month for the input date. If we provide an invalid input date or datetime, it always returns a...
2 min read
MySQL Date/Time weekofyear() Function The weekofyear() is a MySQL date/time function. It is used to get the week of the given date. Syntax select weekofyear(date_value); Parameter: Date_value : date for getting weekofyear Returns: This function returns week of the year for a date value. Example 1 select weekofyear('2018-10-03'); Output: Example 2 select weekofyear('1995-02-11'); Output: TopicMySQL datetime ...
1 min read
MySQL Date/Time time_to_sec() Function The time_to_sec() is a MySQL date/time function. It is used to convert the time into seconds. Syntax select time_to_sec(time); Parameter: Time: time to be converted. Example 1 select time_to_Sec('12:56:12'); Output: Example 2 select time_to_Sec('12:56:12.000002'); Output: TopicMySQL datetime ...
1 min read
MySQL DAYOFMONTH() Function The dayofmonth() is a MySQL date/time function. It is used to get the day from the given date. Syntax select dayofmonth('date'); Parameter: date_name: date for getting day. Returns This function returns the day portion of a date value. Example 1 Select dayofmonth('2018-09-25'); Output: Example 2 Select dayofmonth('2018-09-10'); Output: TopicMySQL date/time ...
1 min read
MySQL Date/Time Sysdate() Function The sysdate() is a MySQL date/time function. It is used to get the system date. Syntax select sysdate(); Returns This function returns the system date. Example 1 select sysdate(); Output: Example 2 select sysdate()+2; Output: TopicMySQL datetime ...
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 time() Function The time() is a MySQL date/time function. It is used to get the time from given time/datetime. Syntax select time(expression); Parameter: Expression: time/datetime to be extracted. Returns: This function returns the time from the given time/datetime. Example 1 select time('2018-10-01 08:01:23.000005'); Output: Example 2 select time('08:01:23'); Output: TopicMySQL datetime ...
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