GBase 8a provides date_part to extract parts of a date, plus an Oracle-compatible extract . This post covers both functions in the China-domestically developed GBase 8a MPP database from GBASE, with the complete set of type values from the source examples.
Reference
The companion note on the date_trunc date-truncation function.
Syntax
date_part ( type , date ) extract ( type from date )
Enter fullscreen mode
Exit fullscreen mode
type is the part to extract. milliseconds returns a decimal; every other type returns bigint(12) .
date is normally a datetime; a date value is converted to datetime automatically.
date_part accepts the type both with and without quotes, for example year and 'year' . The examples below do not repeat both forms.
epoch is not supported by date_part ; only extract supports it.
Results by type
Every value below comes from the source examples on the test timestamp 2023-04-23 11:12:13.56789 .…