SQL Server Dates Tips
Calculations
- Add and Subtract Dates using DATEADD in SQL Server
- Creating a date dimension or calendar table in SQL Server
- DATEDIFF SQL Server Function
- Handling Special Dates For SQL Server Metrics
- How to Expand a Range of Dates into Rows using a SQL Server Numbers Table
- Mimic timestamp behavior of other database platforms to store last modified date
- Restore SQL Server Databases using DateTime functions
- SQL Server Data Aggregation for Data with Different Sampling Rates
- SQL Server Date Time Calculation Examples
- SQL Server DateDiff Example
- SQL Server Function to Determine a Leap Year
- TSQL Function to Determine Holidays in SQL Server
- Using a calendar table in SQL Server - Part 1
- Using T-SQL to find events that overlap (or don't) in SQL Server
- Work around for calculating age using the SQL Server DateDiff function
Conversions
- Convert SQL Server DateTime Data Type to DateTimeOffset Data Type
- Converting and Using Text Dates as SQL Server Dates
- Converting UTC to local time with SQL Server CLR
- Date and Time Conversions Using SQL Server
- Daylight Savings Time Functions in SQL Server
- Determine SQL Server Date and Time Parts with DATEPART and DATENAME Functions
- Handle conversion between time zones in SQL Server - part 1
- Handle conversion between time zones in SQL Server - part 2
- Handle conversion between time zones in SQL Server - part 3
- SQL Server function to convert integer date to datetime format
Data
Data Types
Date Range
- Fill In Missing Dates for SQL Server Query Output
- SQL Server Date function that determines date range based on weekday
- SQL Server Function to return a range of dates
Formatting
- Build a cheat sheet for SQL Server date and time formats
- Format SQL Server Dates with FORMAT Function
- How SQL Server handles the date format YYYY-MM-DD
- SQL Convert Date to YYYYMMDD
- SQL Server FORMAT Function for Dates, Numbers and SQL Server Agent Dates
Functions
- How to Get Current Date in SQL Server
- Simplify Date Period Calculations in SQL Server
- SQL Server Date and Time Functions with Examples
Troubleshooting
Update