MySQL Date/Time timestamp() Function17 Mar 2025 | 1 min read The timediff() is a MySQL date/time function. It is used to convert the expression into datetime/time. SyntaxParameter: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 1Output: ![]() Example 2Output: ![]() Next TopicMySQL datetime |
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 Date/Time weekday() Function The weekday() is a MySQL date/time function. It is used to get the index for a date. Syntax select weekday(date_value); Parameter: Date_value : date for getting weekday Returns: This function returns the weekday index for a date. Example 1 select weekday('2018-10-03'); Output: Example 2 select weekday('1995-02-11'); 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 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 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/Time sec_to_time() Function The sec_to_time() is a MySQL date/time function. It is used to convert the given second into time. Syntax select sec_to_time(second); Parameter: Second : second value to get time. Example 1 select sec_to_time(2000); Output: Example 2 select sec_to_time(40); 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 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
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 Date/Time Subdate() Function The subdate() is a MySQL date/time function. It is used to get the date which is subtracted by given intervals. Syntax Select subdate(date, interval value unit); kOr Select subdate(date, days); Parameter Date : date by which interval is to be subtracted. Days : number of days in which...
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