Menu

date_part and extract in GBase 8a: Every Type and Its Result
📰

date_part and extract in GBase 8a: Every Type and Its Result

DEV Community: database·Michael·3 days ago
#sab70SPY
#devtodatabase#devto#dev#date_part#gbase
Long article (870 words) — no AI summary yet.
Reading 0:00
15s threshold

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 .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.