MSSQL Query Two Digit Year, Month, and Date

Here’s some SQL Query to get Two Digit Year, Month and Date

Year :

1
print right(year(getdate()), 2)

result :
11

Month :

1
print right('0' + month(getdate()), 2)

result :
03

Date :

1
print right('0' + day(getdate()), 2)

result :
26

2 thoughts on “MSSQL Query Two Digit Year, Month, and Date

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.