Solved

How do I check for first and last day of month in Oracle

Posted on 2014-11-26
2
242 Views
Last Modified: 2014-11-27
Experts,

Does anyone know the syntax for testing for the first and last day of month in Oracle?
0
Comment
Question by:morinia
2 Comments
 
LVL 34

Assisted Solution

by:johnsone
johnsone earned 250 total points
ID: 40467671
First day of the current month at midnight:

trunc(sysdate, 'MM')

Last day of the current month current time of day:

last_day(sysdate)

Last day of the current month midnight:

last_day(trunc(sysdate))

Last day of the current month at end of day:

last_day(trunc(sysdate)) + (84399/86400)
0
 
LVL 22

Accepted Solution

by:
Helena Marková earned 250 total points
ID: 40468481
As an addition to the complex johnsone's answer you can read about datetime format elements:
https://docs.oracle.com/cd/E11882_01/server.112/e41084/sql_elements004.htm#CDEHIFJA
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
Via a live example, show how to take different types of Oracle backups using RMAN.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now