Java bro

Java tutorial

Sql queries

Get last date of last month in sql

In this article we wre going write a query to find last date of a last month. See the below query.

Query :

SELECT TO_CHAR(TRUNC(LAST_DAY(ADD_MONTHS(SYSDATE, -1))),’MM-DD-YYYY’) AS LAST_DATE FROM DUAL ;

Output :

LAST_DATE
02-29-2016

Comments are Closed

Theme by Anders Norén