[
https://issues.apache.org/jira/browse/SPARK-54588?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
ASF GitHub Bot updated SPARK-54588:
-----------------------------------
Labels: pull-request-available (was: )
> Add time_format function to convert TIME values to formatted string
> representations
> -----------------------------------------------------------------------------------
>
> Key: SPARK-54588
> URL: https://issues.apache.org/jira/browse/SPARK-54588
> Project: Spark
> Issue Type: Sub-task
> Components: SQL
> Affects Versions: 4.1.0
> Reporter: Vinod KC
> Priority: Minor
> Labels: pull-request-available
>
> Add a new `{{{}time_format`{}}} SQL function to converts TIME data type
> values to formatted string representations, similar to how
> `{{{}date_format`{}}} works for dates and timestamps.
> Users need a convenient way to format TIME values as strings in various
> formats for display and reporting purposes.
> Implement a `time_format(time, format)`function that:
> * Accepts a TIME value and a format pattern string
> * Returns a formatted string representation of the time
> * Supports standard time format patterns from Java's DateTimeFormatter
> Examples
> {code:java}
> -- 24-hour format
> SELECT time_format(TIME'14:30:45', 'HH:mm:ss');
> -- Returns: '14:30:45'
> -- 12-hour format with AM/PM
> SELECT time_format(TIME'14:30:45', 'hh:mm:ss a');
> -- Returns: '02:30:45 PM'
> -- Custom separators
> SELECT time_format(TIME'14:30:45', 'HH-mm-ss');
> -- Returns: '14-30-45'
> SELECT time_format(TIME'14:05:15', 'H ''hours,'' mm ''minutes and'' ss
> ''seconds''');
> -- Returns: '14 hours, 05 minutes and 15 seconds'
> {code}
>
>
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]