UNIX_TIMESTAMP() function in MySQL Last Updated : 22 Dec, 2020 Comments Improve Suggest changes Like Article Like Report UNIX_TIMESTAMP() : This function in MySQL helps to return a Unix timestamp. We can define a Unix timestamp as the number of seconds that have passed since ‘1970-01-01 00:00:00’UTC. Even if you pass the current date/time or another specified date/time, the function will return a Unix timestamp based on that. Syntax : UNIX_TIMESTAMP() UNIX_TIMESTAMP(date) Parameters : It will accept only one argument. date - A date value which can be DATE, DATETIME, TIMESTAMP, or a number in 'YYYYMMDD' or 'YYMMDD' format. Return : If no parameter is passed, the function will return a Unix timestamp in seconds since '1970-01-01 00:00:00' UTC in form of an unsigned integer. But if the date parameter is passed, the function will return the value of parameter in form of an unsigned integer in seconds since '1970-01-01 00:00:00' UTC. Example-1 : Working of UNIX_TIMESTAMP() using Current date/time. SELECT UNIX_TIMESTAMP() As TimeStamp; Output : TimeStamp1606925233 Example-2 : Working of UNIX_TIMESTAMP() using date value '1999-01-22'. SELECT UNIX_TIMESTAMP('1999-01-22') As TimeStamp; Output : TimeStamp916988400 Example-3 : Working of UNIX_TIMESTAMP() using DateTime value '2020-10-17 02:35:43'. SELECT UNIX_TIMESTAMP('2020-10-17 02:35:43') As TimeStamp; Output : TimeStamp1602923743 Example-4 : Working of UNIX_TIMESTAMP() using DateTime value along with fractional seconds '2020-10-17 02:35:43.12345'. SELECT UNIX_TIMESTAMP('2020-10-17 02:35:43.12345') As TimeStamp; Output : TimeStamp1602923743.12345 Comment More infoAdvertise with us Next Article UNIX_TIMESTAMP() function in MySQL vanshgaur14866 Follow Improve Article Tags : Technical Scripter SQL Technical Scripter 2020 DBMS-SQL mysql +1 More Similar Reads UTC_TIMESTAMP() function in MySQL UTC_TIMESTAMP() function in MySQL is used to check current Coordinated Universal Time (UTC) date and time value. It returns the current UTC date and time value in YYYY-MM-DD HH:MM:SS or YYYYMMDDHHMMSS.uuu format, depending on whether the function is used in string or numeric context. Syntax : UTC_TI 2 min read TIMESTAMPDIFF() function in MYSQL TIMESTAMPDIFF() : This function in MySQL is used to return a value after subtracting a DateTime expression from another. Syntax : TIMESTAMPDIFF(unit,expr1,expr2) Parameters : It will accept three parameters. unit â It denotes the unit for the result. It can be one of the following.MICROSECOND, SECON 2 min read UTC_TIME() function in MySQL UTC_TIME() function in MySQL is used to check current Coordinated Universal Time (UTC) time value. It returns the UTC time value in 'HH:MM:SS' or HHMMSS format, depending on whether the function is used in string or numeric context. Syntax : UTC_TIME OR UTC_TIME() Parameter : This method does not ac 2 min read CURRENT_TIMESTAMP() function in MySQL CURRENT_TIMESTAMP() function in MySQL is used to check the current date and time value. In MySQL function, CURRENT_TIMESTAMP is needed when you need to keep a record of the exact time of delivery which is helpful in improving the services and functionalities of any organization. The format of this f 2 min read TIME() Function in MySQL The TIME() function in MySQL is used to extract the time portion from a date or datetime expression, returning the time in the format 'HH:MM'. This function is particularly useful when working with time components in databases, such as scheduling or logging systems. In this article, We will learn ab 4 min read SEC_TO_TIME() Function in MySQL SEC_TO_TIME() function : This function in MySQL is used to return a time value based on the specified seconds value. Here the returned time value will be in the format of HH:MM:SS. For example, if the specified second value is 63, this function will return "00:01:03". Syntax : SEC_TO_TIME(seconds) P 1 min read LOCALTIMESTAMP() Function in MySQL LOCALTIMESTAMP() function : This function in MySQL is used to return the current date and time in the format of "YYYY-MM-DD HH-MM-SS" (string) or as YYYYMMDDHHMMSS.uuuuuu (numeric). Syntax : LOCALTIMESTAMP OR LOCALTIMESTAMP() Parameter : This method does not accept any parameters. Returns : It retur 1 min read CURRENT_TIME() function in MySQL In MySQL, the CURRENT_TIME() function is a valuable tool for retrieving the current system time from the server, providing the exact time in hours, minutes, and seconds. It is widely used in scenarios where tracking or querying the current time is essential without needing the full date. In this art 3 min read SECOND() Function in MySQL SECOND() function in MySQL is used to return the second portion of a specified time or date-time value. The first parameter in this function will be the date/Date Time. This function returns the seconds from the given date value. The return value (seconds) will be in the range of 0 to 59. In this fu 2 min read FROM_UNIXTIME() function in MySQL FROM_UNIXTIME() : This function in MySQL helps to return date /DateTime representation of a Unix timestamp. The format of returning value will be âYYYY-MM-DD HH:MM:SSâ or 'YYYYMMDDHHMMSS', depending on the context of the function. Syntax : FROM_UNIXTIME(unix_timestamp, format) Parameters : The funct 2 min read Like