> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sdf.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Date & Time Functions

## `add_months`

*Supported Signatures*

```sql theme={null}
function add_months(string, bigint) returns timestamp
```

[🔗 Official Documentation](https://docs.snowflake.com/en/sql-reference/functions/add_months)

## `convert_timezone`

Returns the input timestamp converted from source timezone to a destination timezone
*Supported Signatures*

```sql theme={null}
function convert_timezone $1(varchar, varchar, $1) returns timestamp
	where $1 in (timestamp, string)
function convert_timezone $1(varchar, $1) returns timestamp
	where $1 in (timestamp, string)
```

[🔗 Official Documentation](https://docs.snowflake.com/en/sql-reference/functions/convert_timezone)

## `date_from_parts`

Construct a date from individual components
*Supported Signatures*

```sql theme={null}
function date_from_parts(decimal(38, 0), decimal(38, 0), decimal(38, 0)) returns date
```

[🔗 Official Documentation](https://docs.snowflake.com/en/sql-reference/functions/date_from_parts)

## `date_part`

*Supported Signatures*

```sql theme={null}
function date_part $1(string, $1) returns decimal(9, 0)
	where string in (year, y, yy, yyy, yyyy, yr, years, yrs, month, mm, mon, mons, months, day, d, dd, days, dayofmonth, dayofweek, weekday, dow, dw, dayofweekiso, weekday_iso, dow_iso, dw_iso, dayofyear, yearday, doy, dy, week, w, wk, weekofyear, woy, wy, weekiso, week_iso, weekofyeariso, weekofyear_iso, quarter, q, qtr, qtrs, quarters, yearofweek, yearofweekiso, hour, h, hh, hr, hours, hrs, minute, m, mi, min, minutes, mins, second, s, sec, seconds, secs, nanosecond, ns, nsec, nanosec, nsecond, nanoseconds, nanosecs, nseconds, epoch_second, epoch, epoch_seconds, epoch_millisecond, epoch_milliseconds, epoch_microsecond, epoch_microseconds, epoch_nanosecond, epoch_nanoseconds, timezone_hour, tzh, timezone_minute, tzm)
	where $1 in (date, time, timestamp, varchar)
```

[🔗 Official Documentation](https://docs.snowflake.com/en/sql-reference/functions/date_part)

## `date_trunc`

*Supported Signatures*

```sql theme={null}
function date_trunc(string, date) returns date
	where string in (year, y, yy, yyy, yyyy, yr, years, yrs, month, mm, mon, mons, months, day, d, dd, days, dayofmonth, week, w, wk, weekofyear, woy, wy, quarter, q, qtr, qtrs, quarters, hour, h, hh, hr, hours, hrs, minute, m, mi, min, minutes, mins, second, s, sec, seconds, secs, millisecond, ms, mesc, milliseconds, microsecond, us,, usec,, microseconds, nanosecond, ns, nsec, nanosec, nsecond, nanoseconds, nanosecs, nseconds)
function date_trunc(string, time(n)) returns time(n)
	where string in (year, y, yy, yyy, yyyy, yr, years, yrs, month, mm, mon, mons, months, day, d, dd, days, dayofmonth, week, w, wk, weekofyear, woy, wy, quarter, q, qtr, qtrs, quarters, hour, h, hh, hr, hours, hrs, minute, m, mi, min, minutes, mins, second, s, sec, seconds, secs, millisecond, ms, mesc, milliseconds, microsecond, us,, usec,, microseconds, nanosecond, ns, nsec, nanosec, nsecond, nanoseconds, nanosecs, nseconds)
function date_trunc(string, timestamp(n)) returns timestamp(n)
	where string in (year, y, yy, yyy, yyyy, yr, years, yrs, month, mm, mon, mons, months, day, d, dd, days, dayofmonth, week, w, wk, weekofyear, woy, wy, quarter, q, qtr, qtrs, quarters, hour, h, hh, hr, hours, hrs, minute, m, mi, min, minutes, mins, second, s, sec, seconds, secs, millisecond, ms, mesc, milliseconds, microsecond, us,, usec,, microseconds, nanosecond, ns, nsec, nanosec, nsecond, nanoseconds, nanosecs, nseconds)
```

[🔗 Official Documentation](https://docs.snowflake.com/en/sql-reference/functions/date_trunc)

## `dateadd`

*Supported Signatures*

```sql theme={null}
function dateadd $1(string, double, $1) returns $1
	where string in (year, y, yy, yyy, yyyy, yr, years, yrs, month, mm, mon, mons, months, day, d, dd, days, dayofmonth, week, w, wk, weekofyear, woy, wy, quarter, q, qtr, qtrs, quarters, hour, h, hh, hr, hours, hrs, minute, m, mi, min, minutes, mins, second, s, sec, seconds, secs, millisecond, ms, mesc, milliseconds, microsecond, us,, usec,, microseconds, nanosecond, ns, nsec, nanosec, nsecond, nanoseconds, nanosecs, nseconds)
	where $1 in (date, time, timestamp, varchar)
```

[🔗 Official Documentation](https://docs.snowflake.com/en/sql-reference/functions/dateadd)

## `datediff`

*Supported Signatures*

```sql theme={null}
function datediff $1, $2(string, $1, $2) returns bigint
	where string in (year, y, yy, yyy, yyyy, yr, years, yrs, month, mm, mon, mons, months, day, d, dd, days, dayofmonth, week, w, wk, weekofyear, woy, wy, quarter, q, qtr, qtrs, quarters, hour, h, hh, hr, hours, hrs, minute, m, mi, min, minutes, mins, second, s, sec, seconds, secs, millisecond, ms, mesc, milliseconds, microsecond, us,, usec,, microseconds, nanosecond, ns, nsec, nanosec, nsecond, nanoseconds, nanosecs, nseconds)
	where $1 in (date, time, timestamp, varchar)
	and $2 in (date, time, timestamp, varchar)
```

[🔗 Official Documentation](https://docs.snowflake.com/en/sql-reference/functions/datediff)

## `day`

*Supported Signatures*

```sql theme={null}
function day($1) returns bigint
```

[🔗 Official Documentation](https://docs.snowflake.com/en/sql-reference/functions/day)

## `dayname`

*Supported Signatures*

```sql theme={null}
function dayname $1($1) returns varchar
	where $1 in (date, string)
```

[🔗 Official Documentation](https://docs.snowflake.com/en/sql-reference/functions/dayname)

## `dayofmonth`

*Supported Signatures*

```sql theme={null}
function dayofmonth($1) returns bigint
```

[🔗 Official Documentation](https://docs.snowflake.com/en/sql-reference/functions/dayofmonth)

## `dayofweek`

*Supported Signatures*

```sql theme={null}
function dayofweek($1) returns bigint
```

[🔗 Official Documentation](https://docs.snowflake.com/en/sql-reference/functions/dayofweek)

## `dayofweekiso`

*Supported Signatures*

```sql theme={null}
function dayofweekiso($1) returns bigint
```

[🔗 Official Documentation](https://docs.snowflake.com/en/sql-reference/functions/dayofweekiso)

## `dayofyear`

*Supported Signatures*

```sql theme={null}
function dayofyear($1) returns bigint
```

[🔗 Official Documentation](https://docs.snowflake.com/en/sql-reference/functions/dayofyear)

## `extract`

*Supported Signatures*

```sql theme={null}
function extract $1(string, $1) returns double
	where string in (year, y, yy, yyy, yyyy, yr, years, yrs, month, mm, mon, mons, months, day, d, dd, days, dayofmonth, dayofweek, weekday, dow, dw, dayofweekiso, dayofweek_iso, weekday_iso, dow_iso, dw_iso, dayofyear, yearday, doy, dy, week, w, wk, weekofyear, woy, wy, weekiso, week_iso, weekofyeariso, weekofyear_iso, quarter, q, qtr, qtrs, quarters, yearofweek, yearofweekiso, hour, h, hh, hr, hours, hrs, minute, m, mi, min, minutes, mins, second, s, sec, seconds, secs, nanosecond, ns, nsec, nanosec, nsecond, nanoseconds, nanosecs, nseconds, epoch_second, epoch, epoch_seconds, epoch_millisecond, epoch_milliseconds, epoch_microsecond, epoch_microseconds, epoch_nanosecond, epoch_nanoseconds, timezone_hour, tzh, timezone_minute, tzm)
	where $1 in (date, time, timestamp, varchar)
```

[🔗 Official Documentation](https://docs.snowflake.com/en/sql-reference/functions/extract)

## `hour`

*Supported Signatures*

```sql theme={null}
function hour($1) returns bigint
```

[🔗 Official Documentation](https://docs.snowflake.com/en/sql-reference/functions/hour)

## `last_day`

*Supported Signatures*

```sql theme={null}
function last_day $1($1) returns date
	where $1 in (date, time, timestamp, varchar)
function last_day $1($1, string) returns date
	where string in (year, y, yy, yyy, yyyy, yr, years, yrs, month, mm, mon, mons, months, week, w, wk, weekofyear, woy, wy, quarter, q, qtr, qtrs, quarters, hour, h, hh, hr, hours, hrs, minute, m, mi, min, minutes, mins, second, s, sec, seconds, secs, millisecond, ms, mesc, milliseconds, microsecond, us,, usec,, microseconds, nanosecond, ns, nsec, nanosec, nsecond, nanoseconds, nanosecs, nseconds)
	where $1 in (date, time, timestamp, varchar)
```

[🔗 Official Documentation](https://docs.snowflake.com/en/sql-reference/functions/last_day)

## `minute`

*Supported Signatures*

```sql theme={null}
function minute($1) returns bigint
```

[🔗 Official Documentation](https://docs.snowflake.com/en/sql-reference/functions/minute)

## `month`

*Supported Signatures*

```sql theme={null}
function month($1) returns bigint
```

[🔗 Official Documentation](https://docs.snowflake.com/en/sql-reference/functions/month)

## `monthname`

*Supported Signatures*

```sql theme={null}
function monthname $1($1) returns varchar
	where $1 in (date, string)
```

[🔗 Official Documentation](https://docs.snowflake.com/en/sql-reference/functions/monthname)

## `months_between`

*Supported Signatures*

```sql theme={null}
function months_between $1($1, $1) returns bigint
	where $1 in (date, time, timestamp, varchar)
```

[🔗 Official Documentation](https://docs.snowflake.com/en/sql-reference/functions/months_between)

## `next_day`

*Supported Signatures*

```sql theme={null}
function next_day $1($1, varchar) returns date
	where $1 in (date, string)
```

[🔗 Official Documentation](https://docs.snowflake.com/en/sql-reference/functions/next_day)

## `previous_day`

*Supported Signatures*

```sql theme={null}
function previous_day $1($1, varchar) returns date
	where $1 in (date, string)
```

[🔗 Official Documentation](https://docs.snowflake.com/en/sql-reference/functions/previous_day)

## `quarter`

*Supported Signatures*

```sql theme={null}
function quarter($1) returns bigint
```

[🔗 Official Documentation](https://docs.snowflake.com/en/sql-reference/functions/quarter)

## `second`

*Supported Signatures*

```sql theme={null}
function second($1) returns bigint
```

[🔗 Official Documentation](https://docs.snowflake.com/en/sql-reference/functions/second)

## `time_from_parts`

Construct a time from individual components
*Supported Signatures*

```sql theme={null}
function time_from_parts(decimal(38, 0), decimal(38, 0), decimal(38, 0)) returns time
function time_from_parts(decimal(38, 0), decimal(38, 0), decimal(38, 0), decimal(38, 0)) returns time
```

[🔗 Official Documentation](https://docs.snowflake.com/en/sql-reference/functions/time_from_parts)

## `time_slice`

*Supported Signatures*

```sql theme={null}
function time_slice $1($1, bigint, string) returns $1
	where $1 in (date, time, timestamp, varchar)
function time_slice $1($1, bigint, string, string) returns $1
	where $1 in (date, time, timestamp, varchar)
```

[🔗 Official Documentation](https://docs.snowflake.com/en/sql-reference/functions/time_slice)

## `timeadd`

*Supported Signatures*

```sql theme={null}
function timeadd $1(string, double, $1) returns $1
	where string in (year, y, yy, yyy, yyyy, yr, years, yrs, month, mm, mon, mons, months, day, d, dd, days, dayofmonth, week, w, wk, weekofyear, woy, wy, quarter, q, qtr, qtrs, quarters, hour, h, hh, hr, hours, hrs, minute, m, mi, min, minutes, mins, second, s, sec, seconds, secs, millisecond, ms, mesc, milliseconds, microsecond, us,, usec,, microseconds, nanosecond, ns, nsec, nanosec, nsecond, nanoseconds, nanosecs, nseconds)
	where $1 in (date, time, timestamp, varchar)
```

[🔗 Official Documentation](https://docs.snowflake.com/en/sql-reference/functions/timeadd)

## `timediff`

*Supported Signatures*

```sql theme={null}
function timediff $1(string, $1, $1) returns bigint
	where string in (year, y, yy, yyy, yyyy, yr, years, yrs, month, mm, mon, mons, months, day, d, dd, days, dayofmonth, week, w, wk, weekofyear, woy, wy, quarter, q, qtr, qtrs, quarters, hour, h, hh, hr, hours, hrs, minute, m, mi, min, minutes, mins, second, s, sec, seconds, secs, millisecond, ms, mesc, milliseconds, microsecond, us,, usec,, microseconds, nanosecond, ns, nsec, nanosec, nsecond, nanoseconds, nanosecs, nseconds)
	where $1 in (date, time, timestamp, varchar)
```

[🔗 Official Documentation](https://docs.snowflake.com/en/sql-reference/functions/timediff)

## `timestamp_from_parts`

Construct a timestamp from individual components
*Supported Signatures*

```sql theme={null}
function timestamp_from_parts(decimal(38, 0), decimal(38, 0), decimal(38, 0), decimal(38, 0), decimal(38, 0), decimal(38, 0)) returns timestamp
function timestamp_from_parts(decimal(38, 0), decimal(38, 0), decimal(38, 0), decimal(38, 0), decimal(38, 0), decimal(38, 0), decimal(38, 0)) returns timestamp
function timestamp_from_parts(decimal(38, 0), decimal(38, 0), decimal(38, 0), decimal(38, 0), decimal(38, 0), decimal(38, 0), decimal(38, 0), varchar) returns timestamp
function timestamp_from_parts(date, time) returns timestamp
```

[🔗 Official Documentation](https://docs.snowflake.com/en/sql-reference/functions/timestamp_from_parts)

## `timestampadd`

*Supported Signatures*

```sql theme={null}
function timestampadd $1(string, double, $1) returns $1
	where string in (year, y, yy, yyy, yyyy, yr, years, yrs, month, mm, mon, mons, months, day, d, dd, days, dayofmonth, week, w, wk, weekofyear, woy, wy, quarter, q, qtr, qtrs, quarters, hour, h, hh, hr, hours, hrs, minute, m, mi, min, minutes, mins, second, s, sec, seconds, secs, millisecond, ms, mesc, milliseconds, microsecond, us,, usec,, microseconds, nanosecond, ns, nsec, nanosec, nsecond, nanoseconds, nanosecs, nseconds)
	where $1 in (date, time, timestamp, varchar)
```

[🔗 Official Documentation](https://docs.snowflake.com/en/sql-reference/functions/timestampadd)

## `timestampdiff`

*Supported Signatures*

```sql theme={null}
function timestampdiff $1(string, $1, $1) returns bigint
	where string in (year, y, yy, yyy, yyyy, yr, years, yrs, month, mm, mon, mons, months, day, d, dd, days, dayofmonth, week, w, wk, weekofyear, woy, wy, quarter, q, qtr, qtrs, quarters, hour, h, hh, hr, hours, hrs, minute, m, mi, min, minutes, mins, second, s, sec, seconds, secs, millisecond, ms, mesc, milliseconds, microsecond, us,, usec,, microseconds, nanosecond, ns, nsec, nanosec, nsecond, nanoseconds, nanosecs, nseconds)
	where $1 in (date, time, timestamp, varchar)
```

[🔗 Official Documentation](https://docs.snowflake.com/en/sql-reference/functions/timestampdiff)

## `trunc`

truncate the fractional or date part
*Supported Signatures*

```sql theme={null}
function trunc(decimal(38, 0)) returns decimal(38, 0)
function trunc(decimal(38, 0), decimal(38, 0)) returns decimal(38, 0)
function trunc(double) returns double
function trunc(double, double) returns double
function trunc(date, varchar) returns date
function trunc(time, varchar) returns time
function trunc(timestamp, varchar) returns timestamp
```

[🔗 Official Documentation](https://docs.snowflake.com/en/sql-reference/functions/trunc)

## `week`

*Supported Signatures*

```sql theme={null}
function week($1) returns bigint
```

[🔗 Official Documentation](https://docs.snowflake.com/en/sql-reference/functions/week)

## `weekiso`

*Supported Signatures*

```sql theme={null}
function weekiso($1) returns bigint
```

[🔗 Official Documentation](https://docs.snowflake.com/en/sql-reference/functions/weekiso)

## `weekofyear`

*Supported Signatures*

```sql theme={null}
function weekofyear($1) returns bigint
```

[🔗 Official Documentation](https://docs.snowflake.com/en/sql-reference/functions/weekofyear)

## `year`

*Supported Signatures*

```sql theme={null}
function year($1) returns bigint
```

[🔗 Official Documentation](https://docs.snowflake.com/en/sql-reference/functions/year)

## `yearofweek`

*Supported Signatures*

```sql theme={null}
function yearofweek($1) returns bigint
```

[🔗 Official Documentation](https://docs.snowflake.com/en/sql-reference/functions/yearofweek)

## `yearofweekiso`

*Supported Signatures*

```sql theme={null}
function yearofweekiso($1) returns bigint
```

[🔗 Official Documentation](https://docs.snowflake.com/en/sql-reference/functions/yearofweekiso)
