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, 2485🔥, 0💬
Popular Posts:
How to calculate the storage size of a JSON (JavaScript Object Notation) value using the JSON_STORAG...
How To Start the Command-Line SQL*Plus in Oracle? If you Oracle server or client installed on your w...
How To Change the Password for Your Own User Account in MySQL? If you want to change the password of...
How To Set Up SQL*Plus Output Format in Oracle? If you want to practice SQL statements with SQL*Plus...
What Happens If the UPDATE Subquery Returns Multiple Rows in SQL Server? If a subquery is used in a ...