Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
#T-SQL 37 22 bytes
Saved 15 bytes thanks to BradC's comment.
The usual hardcoded variable for lack of a stdin.
stdin
e.g.
DECLARE @ NVARCHAR(4) = '2016'
Then the solution is:
PRINT ISDATE(@+'0229')
#T-SQL 3737 22 bytes
PRINT IIF(ISDATE(@+'0229')=1,'y','n')
#T-SQL 37 bytes
#T-SQL 37 3537 bytes
PRINT IIF(ISDATE(@+0229@+'0229')=1,'y','n')
Edit: Saved 2 bytes, we don't need the quotes('') in the concatenation.
#T-SQL 37 35 bytes
PRINT IIF(ISDATE(@+0229)=1,'y','n')