Collections:
Converting Integers into Date and Time Values in SQL Server
Can Integers Be Converted into Date and Time Values in SQL Server Transact-SQL?
✍: FYIcenter.com
Can integers be converted into date and time values? The answer is yes. The input integer will be used as the number of days relative to the base date: Jan 1, 1900. The time of the day will be set to 0, midnight of the day. But there several rules you need to follow:
Here are some good examples:
-- Explicit conversion is supported DECLARE @birth_date DATETIME; SET @birth_date = CONVERT(DATETIME, 36583); SELECT @birth_date; GO 2000-02-29 00:00:00.000 -- Explicit conversion is supported DECLARE @birth_date DATETIME; SET @birth_date = CONVERT(DATETIME, 36583); SELECT @birth_date; GO 2000-02-29 00:00:00.000
⇒ Converting DATETIME and NUMERIC Values in SQL Server
⇐ Converting Date and Time Values into Integers in SQL Server
⇑ Date/Time Operations and Functions in SQL Server Transact-SQL
2017-02-22, 3689🔥, 0💬
Popular Posts:
Why I Can Not Enter 0.001 Second in DATETIME values in SQL Server Transact-SQL? If you enter millise...
How To Get the Definition of a View Out of the SQL Server in SQL Server? If you want get the definit...
How To Provide Default Values to Function Parameters in SQL Server Transact-SQL? If you add a parame...
What Are the Underflow and Overflow Behaviors on FLOAT Literals in SQL Server Transact-SQL? If you e...
How To Convert Numeric Values to Integers in SQL Server Transact-SQL? Sometimes you need to round a ...