Home >> FAQs/Tutorials >> SQL Server FAQ
SQL Server FAQs - Transact-SQL Date and Time Operations and Functions
A collection of 18 FAQs on Transact-SQL language date and time operations and functions. Clear answers are provided with tutorial exercises on converting date and time values to integers or decimal values; incrementing and decrementing date parts; taking date differences; formatting dates to strings; getting GMT times.
Topics included in this FAQ are:
- How To Add or Remove Days on Date and Time Values?
- Can Date and Time Values Be Converted into Integers?
- Can Integers Be Converted into Date and Time Values?
- Are DATETIME and NUMERIC Values Convertible?
- Can a DATETIME Value Be Subtracted from Another DATETIME Value?
- What Are the Date and Time Functions Supported by SQL Server 2005?
- How To Increment or Decrement Parts of DATETIME Values?
- How To Use DATEADD() Function?
- How To Calculate DATETIME Value Differences Using the DATEDIFF() Function?
- How To Calculate Age in Days, Hours and Minutes?
- How To Get Month and Weekday Names from DATETIME Values?
- How To Get Parts of DATETIME Values as Integers?
- How To Get Year, Month and Day Out of DATETIME Values?
- What Is the Difference Between GETDATE() and GETUTCDATE()?
- How To Format Time Zone in +/-hh:mm Format?
- How To Format DATETIME Values to Strings with the CONVERT() Function?
- How To Truncate DATETIME Values to Dates without Time?
- How To Set Different Parts of a DATETIME Value?
Please note that all answers and tutorials are based on MS SQL Server 2005.
To follow tutorials in this collection, you should connect to SQL server
as a regular user who has enough permissions to run simple Transact-SQL statements.
For questions on Transact-SQL language, see the other FAQ collections.
(Continued on next topic...)