FROM_UNIXTIME() function in MySQL Last Updated : 22 Dec, 2020 Comments Improve Suggest changes Like Article Like Report 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 function can accept two arguments as follows. unix_timestamp - It is an internal timestamp value and it's value can be produced by UNIX_TIMESTAMP() function. format - The way in which the resulting value will be formatted Result : The function will return date /DateTime representation of a Unix timestamp. And the format of returning value will be ‘YYYY-MM-DD HH:MM:SS’ or 'YYYYMMDDHHMMSS', depending on the context of the function. Example-1 : Working of FROM_UNIXTIME() function with one parameter. SELECT FROM_UNIXTIME(599462400) AS Unix; Output : Unix 1988-12-29 22:20:00 Example-2 : Working of FROM_UNIXTIME() function with fractional seconds. SELECT FROM_UNIXTIME(599462445.99999) AS Unix; Output : Unix 1988-12-29 22:20:45.99999 Example-3 : Working of FROM_UNIXTIME() function when both parameters are passed. When format is '%W, %D %M %Y' - SELECT FROM_UNIXTIME(799462445, '%W, %D %M %Y') AS Unix; Output : Unix Tuesday, 2nd May 1995 When format is '%h:%i %p, %D %M %Y' - SELECT FROM_UNIXTIME(799462445, '%h:%i %p, %D %M %Y') AS Unix; Output : Unix 06:54 PM, 2nd May 1995 Example-4 : Working of FROM_UNIXTIME() function in Numeric context. SELECT FROM_UNIXTIME(846562400) As 'String_form', FROM_UNIXTIME(846562400) + 1 As 'Numeric_form'; Output : String_formNumeric_form1996-10-28 21:13:2019961028211321 Comment More infoAdvertise with us Next Article FROM_UNIXTIME() function in MySQL V vanshgaur14866 Follow Improve Article Tags : Technical Scripter SQL Technical Scripter 2020 DBMS-SQL mysql +1 More Similar Reads 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 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 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 FROM_DAYS() Function in MySQL FROM_DAYS() : This function is used to return the date from a specified numeric date value. Here specified date value is divided by 365 and accordingly years, months, and days are returned. This function is used only with dates within the Gregorian calendar. Features : This function is used to find 2 min read SUBDATE() function in MySQL SUBDATE() function in MySQL is used to subtracts a time value (as interval) from a given date. Syntax : SUBDATE(date, INTERVAL expr unit) Parameter : This function accepts three parameters as given below : date : First specified date. expr : The value of the time/date interval to subtract. unit : Th 2 min read Like