Forum Discussion
A819A1L
May 24, 2023Brass Contributor
Convert DATETIME to YYYYMMDD
Hello, I'm struggling to work out how to achieve today's date in numbers using GETDATE(). The result I need is 20230524. So today's date in 8 digits as int starting with year: YYYYMMDD Th...
- May 25, 2023
If anyone knows of a better way, feel free to educate me 🙂
A819A1L , there is one:
-- Date format 112 = ISO = YYYYMMDD SELECT CONVERT(int, CONVERT(char(10), GETDATE(), 112))
olafhelper
May 25, 2023Bronze Contributor
If anyone knows of a better way, feel free to educate me 🙂
A819A1L , there is one:
-- Date format 112 = ISO = YYYYMMDD
SELECT CONVERT(int, CONVERT(char(10), GETDATE(), 112))A819A1L
May 25, 2023Brass Contributor
olafhelper amazing thanks!