Hi,
How to get start date and end dates in a query from database.
Thanks,
Lico
Hi,
How to get start date and end dates in a query from database.
Thanks,
Lico
CURRENT_DATE[()] | CURDATE() | SYSDATE | TODAY = returns current date
Start of month:
DATE EXTRACT(YEAR FROM SYSDATE) +'-'+ EXTRACT(MONTH FROM SYSDATE) +'-01'
http://sqltutorials.blogspot.com/2007/06/sql-first-and-last-day-of-month.html
Only thing that isn't covered is how to retrieve the current date... see rexem's post.
For completeness, start of month:
DATE EXTRACT(YEAR FROM SYSDATE) +'-'+ EXTRACT(MONTH FROM SYSDATE) +'-01'
End of month:
DATEADD('DAY', -1, DATEADD('MONTH', 1, DATE EXTRACT(YEAR FROM SYSDATE) +'-'+ EXTRACT(MONTH FROM SYSDATE) +'-01'))