Skip to main content

Celonis Product Documentation

DAYS_IN_MONTH
Description

Returns the number of days in the given month of the given timestamp.

Supported input column type: DATE

Output column type: INT

Syntax
  DAYS_IN_MONTH( table.column )
 
NULL handling

If any parameter is NULL, the result is NULL as well.

Examples

[1]

In this example, the number of days for each month in year 2020 is returned.

Query

Column1

         DAYS_IN_MONTH ( "Table1"."Column1" )
        

Input

Output

Table1

Column1 : date

Wed Jan 01 2020 00:00:00.000

Sat Feb 01 2020 00:00:00.000

Sun Mar 01 2020 00:00:00.000

Wed Apr 01 2020 00:00:00.000

Fri May 01 2020 00:00:00.000

Mon Jun 01 2020 00:00:00.000

Wed Jul 01 2020 00:00:00.000

Sat Aug 01 2020 00:00:00.000

Tue Sep 01 2020 00:00:00.000

Thu Oct 01 2020 00:00:00.000

Sun Nov 01 2020 00:00:00.000

Tue Dec 01 2020 00:00:00.000

Result

Column1 : int

31

29

31

30

31

30

31

31

30

31

30

31

[2]

The month of February has 28 or 29 days, depending on whether the year is a leap year.

Query

Column1

         DAYS_IN_MONTH ( "Table1"."Column1" )
        

Input

Output

Table1

Column1 : date

Sat Feb 01 2020 00:00:00.000

Fri Feb 01 2019 00:00:00.000

Thu Feb 01 2018 00:00:00.000

Wed Feb 01 2017 00:00:00.000

Mon Feb 01 2016 00:00:00.000

Sun Feb 01 2015 00:00:00.000

Result

Column1 : int

29

28

28

28

29

28

[3]

DAYS_IN_MONTH does not consider the day in the given timestamp. Even if an incorrect timestamp is provided, it will still return the actual number of days in the month.

Query

Column1

         DAYS_IN_MONTH ( "Table1"."Column1" )
        

Input

Output

Table1

Column1 : date

Sat Feb 29 2020 00:00:00.000

Sat Feb 29 2020 00:00:00.000

Thu Feb 28 2019 00:00:00.000

Thu Feb 28 2019 00:00:00.000

Result

Column1 : int

29

29

28

28