dfr datepart
for expression> dfr datepart {flags} (Datepart name)
Datepart name
: Part of the date to capture. Possible values are year, quarter, month, week, weekday, day, hour, minute, second, millisecond, microsecond, nanosecondinput | output |
---|---|
any | any |
Creates an expression to capture the year date part
> [["2021-12-30T01:02:03.123456789"]] |dfr into-df|dfr as-datetime"%Y-%m-%dT%H:%M:%S.%9f"|dfr with-column [(dfr coldatetime|dfr datepartyear|dfr asdatetime_year )]
╭───┬─────────────┬───────────────╮
│# │ datetime │ datetime_year │
├───┼─────────────┼───────────────┤
│0│2yearsago│2021│
╰───┴─────────────┴───────────────╯
Creates an expression to capture multiple date parts
> [["2021-12-30T01:02:03.123456789"]] |dfr into-df|dfr as-datetime"%Y-%m-%dT%H:%M:%S.%9f"|
dfr with-column [ (dfr coldatetime|dfr datepartyear|dfr asdatetime_year ),
(dfr coldatetime|dfr datepartmonth|dfr asdatetime_month ),
(dfr coldatetime|dfr datepartday|dfr asdatetime_day ),
(dfr coldatetime|dfr dateparthour|dfr asdatetime_hour ),
(dfr coldatetime|dfr datepartminute|dfr asdatetime_minute ),
(dfr coldatetime|dfr datepartsecond|dfr asdatetime_second ),
(dfr coldatetime|dfr datepartnanosecond|dfr asdatetime_ns ) ]
╭─────┬───────────────┬────────────────┬─────────────────┬───────────────┬────────────────┬──────────────────┬──────╮
│# │ datetime │ datetime_year │ datetime_month │ datetime_day │ datetime_hour │ datetime_minute │ ... │
├─────┼───────────────┼────────────────┼─────────────────┼───────────────┼────────────────┼──────────────────┼──────┤
│0│2yearsago│2021│12│30│1│2│...│
╰─────┴───────────────┴────────────────┴─────────────────┴───────────────┴────────────────┴──────────────────┴──────╯
Tips: Dataframe commands were not shipped in the official binaries by default, you have to build it with --features=dataframe
flag
Copyright © 2019–2023 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/dfr_datepart.html