MySQL CURRENT_TIMESTAMP() Function17 Mar 2025 | 1 min read The current_timestamp() is a MySQL date/time function. It is used to get the current date and time. SyntaxParameterNA ReturnsThe current_timestamp function returns the current date and time. It will return the current date as a 'YYYY-MM-DD HH:MM:SS' format if used in a string context. It will return the current date as a YYYYMMDDHHMMSS format if used in a numeric context. Example 1Output: ![]() Example 2Output: ![]() Next TopicMySQL date/time |
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 maketime() Function The maketime() is a MySQL date/time function. It is used to make the time from given hour, minute and second. Syntax select maketime(hour, minute, second); Parameter: hour: hour value for making time minute: minute value for making time second: second value for making time Returns: This function returns the time for...
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 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 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 period_diff() Function The period_diff() is a MySQL date/time function. It is used to get the difference between two given periods. Syntax select period_diff(period1, period2); Parameter: period1 : period value in formate YYMM or YYYYMM. period2 : period value in formate YYMM or YYYYMM. Returns: This function returns the difference in months between...
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 date/time functions are used to manipulate temporal values. The following table indicates each of the functions with a brief description: Functions Description date() The date() function is used to get the date from given date/datetime. adddata() The adddata() function is used to get the date in which some time/date intervals...
4 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
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
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