TO_START_OF_YEAR

Returns the first day of the year for a date or a date with time (timestamp/datetime).

Analyze Syntax

func.to_start_of_year(<expr>)

Analyze Examples

func.to_start_of_year('2023-11-12 09:38:18.165575')

┌────────────────────────────────────────────────────────────────┐
 func.to_start_of_year('2023-11-12 09:38:18.165575')            
                          Date                                  
├────────────────────────────────────────────────────────────────┤
 2023-01-01                                                     
└────────────────────────────────────────────────────────────────┘

SQL Syntax

TO_START_OF_YEAR(<expr>)

Arguments

ArgumentsDescription
<expr>date/timestamp

Return Type

DATE, returns date in “YYYY-MM-DD” format.

SQL Examples

SELECT
  to_start_of_year('2023-11-12 09:38:18.165575')

┌────────────────────────────────────────────────┐
 to_start_of_year('2023-11-12 09:38:18.165575') 
                      Date                      
├────────────────────────────────────────────────┤
 2023-01-01                                     
└────────────────────────────────────────────────┘
Last modified June 12, 2024 at 9:53 PM EST: updating datetime functions (f087f54)