I’m endlessly frustrated by working with date and datetime types in T-SQL and PL/SQL, so I often end up complicating myself into a corner working with them.
I’m running the risk of another “duh” comment by posting something so simple, but the syntax in T-SQL and PL/SQL to get the date of a year, or any number of days from today’s date is just:
T-SQL: SELECT GETDATE() - 365;
PL/SQL: SELECT TO_DATE(CURRENT_DATE) - 365 FROM DUAL
No comments:
Post a Comment