Berserk Docs
Scalar FunctionsDate & Time Functions

datetime_part

Extracts the specified part from a datetime value.

Syntax

datetime_part(part, date)

Parameters

Prop

Type

Returns: int

Examples

Example 1

print datetime_part("month", datetime(2024-06-08)) // month of the Lindisfarne raid
print_0 (int)
6

Example 2

print datetime_part("year", datetime(2024-09-25)) // year of the Battle of Stamford Bridge
print_0 (int)
2024

On this page