access_time 4 months ago languageEnglish
more_vert

Teradata SQL - First Day of a Month

visibility 120 comment 0

Introduction

In Teradata, we can derive the first day of the month from a specified date.

Code snippet

The following code snippet shows the month start date of the current month:

SELECT CURRENT_DATE - EXTRACT(DAY FROM CURRENT_DATE) + 1 AS MONTH_START_DATE;

Output:

MONTH_START_DATE

1 1/02/2021


Similarly, table column or DATE expressions can be used with the function.

SELECT DATE'2021-12-31' - EXTRACT(DAY FROM DATE'2021-12-31') + 1 AS MONTH_START_DATE;

Output:

MONTH_START_DATE

1 1/12/2021


copyright This page is subject to Site terms.
Like this article?
Share on

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts

Follow Kontext

Get our latest updates on LinkedIn.

Want to contribute on Kontext to help others?

Learn more

More from Kontext

visibility 262
thumb_up 0
access_time 5 months ago
visibility 1288
thumb_up 0
access_time 9 months ago
visibility 550
thumb_up 0
access_time 9 months ago
visibility 23
thumb_up 0
access_time 3 months ago