Skip to content

Implement date/time -> string formatting functions #9147

@alamb

Description

@alamb

Is your feature request related to a problem or challenge?

Asked about in Discord

DataFusion doesn't have any time formatting functions, right? i.e. something like date_time.format("%d/%m/%Y")

The idea is to be able to format timestamps / dates back to different formats of strings

Describe the solution you'd like

Implement some sort of date/time/timestamp -> string formatting function that takes a user defined formatting string (probably chrono format) and returns a string

For example the postgres to_char function does this:
https://www.postgresql.org/docs/current/functions-formatting.html

Spark may have a better API (I haven't researched it)

arrow-rs already has the actual formatting code in ArrayFormatter:
https://docs.rs/arrow/latest/arrow/util/display/struct.ArrayFormatter.html

And specify by
https://docs.rs/arrow/latest/arrow/util/display/struct.FormatOptions.html

So this project is likely just to define a function, wire it in, and write some tests

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions