Press "Enter" to skip to content

Determining the First Date or Day in a Month in Oracle

Determining the First Date or Day in a Month in Oracle

Problem
You need to dynamically determine the first date in a given month at runtime.Solution
Oracle’s TRUNC function can be used on dates to perform start-of-period calculations, such as the first
day of the month.

select trunc(sysdate,’mm’)
from dual;

TRUNC(SYS
———
01-MAY-09

Our recipe was written on May 21st. Any arbitrary date, datetime, or timestamp expression can be
used.

Vinish Kapoor

Hi, I am a full stack developer and writing about development. I document everything I learn and help thousands of people. foxinfotech.in is created, written, and maintained by me; it is built on WordPress, and hosted by Bluehost. Connect with me on Facebook, Twitter, GitHub, and get notifications for new posts.

Be First to Comment

    Leave a Reply

    Your email address will not be published. Required fields are marked *