Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

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

Suggested Solutions

Title # Comments Views Activity
pivot rows to columns 1 34
CSV How to add columns based on existing column(s)? 20 32
Filtering characters in an SQL field 2 16
add more rows to hierarchy 3 25
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
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.
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

791 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