Solved

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

Posted on 2014-11-26
2
236 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…

757 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

17 Experts available now in Live!

Get 1:1 Help Now