DB2: First day of month and Last day of month
That’s a very simple tip but may be useful sometimes.
In Db2 database how to get the first day of current month for example?
You can do something like this:
select current date + 1 days - day(current date) days from schema.table_name
Or, how to get the last day of the current month?
Doing something like this:
select current date + 1 month - day(current date + 1 month) days from schema.table_name
I don’t know if that is the best solution but that’s already save me. If you know a better solution, please let me know.
All the best,