SQL Date/Time Functions
Date and time functions — NOW, DATE, EXTRACT, DATEDIFF, DATE_ADD, DATE_FORMAT. This category documents 32 SQL date/time functions entries, and each page gives you the full syntax, the parameter list, the return value, and a runnable example tested against MySQL, PostgreSQL, SQL Server, and SQLite. The entries are: NOW(), CURDATE(), DATE(), EXTRACT(), DATE_ADD(), DATE_SUB(), DATEDIFF(), DATE_FORMAT(), STR_TO_DATE(), CURRENT_TIMESTAMP, UTC_TIMESTAMP(), TIME(), HOUR() / MINUTE() / SECOND(), YEAR() / MONTH() / DAY(), WEEK() / WEEKDAY() / DAYOFWEEK(), DAYNAME() / MONTHNAME(), LAST_DAY(), UNIX_TIMESTAMP(), FROM_UNIXTIME(), TIMESTAMPDIFF(), TIMESTAMPADD(), CONVERT_TZ(), MAKEDATE() / MAKETIME(), ADDTIME() / SUBTIME(), QUARTER(), TIMESTAMP WITH TIME ZONE, CURRENT_DATE / CURRENT_TIME, SWITCHOFFSET(), TODATETIMEOFFSET(), DATETIME2 vs DATETIME, SQL Server DATEADD with Variables, SQL Server DATEDIFF with Variables. Not sure where to start? NOW() and CURDATE() are the most commonly used entries in this category. You can also search across every category from the search page, browse the complete A–Z index, or try any of these statements live in the SQL playground.