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
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
FYI, I had to cast the month as a varchar in order for this to work.
Updated missing “)” in Date query