A. Getting Year, Month, Day from Date SQL> — EXTRACT(): return a year, month, day, hour, minute, second, or time zone from x; SQL> SQL> SELECT EXTRACT(YEAR FROM TO_DATE(’01-JAN-2005 19:15:26′,’DD-MON-YYYY HH24:MI:SS’)) AS YEAR FROM dual; YEAR ———- 2005 B. Date Format & Number Format TO_CHAR Convert a numeric or date expression to a character String. … Continue reading
Datetime functions allow manipulating columns with DATETIME/SMALLDATETIME data types. SQL server DateTime Function: GETDATE and GETUTCDATE Functions GETDATE and GETUTCDATE Functions are Nondeterministic function. Both functions returns the current date and time. GETDATE returns current system date and time of the computer where SQL Server is running. GETUTCDATE returns current UTC time (Universal Time Coordinate … Continue reading