From c7c4f1cb3f422f8b6ba7a01cabc869ecaf1e2286 Mon Sep 17 00:00:00 2001 From: soyeric128 Date: Fri, 16 Jun 2023 16:52:29 +0800 Subject: [PATCH] docs: date_format (#11774) * added * Update dateformat.md --- .../30-datetime-functions/dateformat.md | 31 +++++++++++++++++++ .../60-conversion-functions/index.md | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 docs/doc/15-sql-functions/30-datetime-functions/dateformat.md diff --git a/docs/doc/15-sql-functions/30-datetime-functions/dateformat.md b/docs/doc/15-sql-functions/30-datetime-functions/dateformat.md new file mode 100644 index 0000000000000..d7c714d2de40c --- /dev/null +++ b/docs/doc/15-sql-functions/30-datetime-functions/dateformat.md @@ -0,0 +1,31 @@ +--- +title: DATE_FORMAT +--- + +import FunctionDescription from '@site/src/components/FunctionDescription'; + + + +Converts a date value to a specific string format. To customize the format of date and time in Databend, you can utilize specifiers. These specifiers allow you to define the desired format for date and time values. For a comprehensive list of supported specifiers, see [Formatting Date and Time](../../13-sql-reference/10-data-types/20-data-type-time-date-types.md#formatting-date-and-time). + +## Syntax + +```sql +DATE_FORMAT(, ) +``` + +## Return Type + +String. + +## Examples + +```sql +SELECT DATE_FORMAT('2022-12-25', 'Month/Day/Year: %m/%d/%Y') + ++-------------------------------------------------------+ +| date_format('2022-12-25', 'month/day/year: %m/%d/%y') | ++-------------------------------------------------------+ +| Month/Day/Year: 12/25/2022 | ++-------------------------------------------------------+ +``` \ No newline at end of file diff --git a/docs/doc/15-sql-functions/60-conversion-functions/index.md b/docs/doc/15-sql-functions/60-conversion-functions/index.md index b5f275f67e952..84e7f5a0e1d52 100644 --- a/docs/doc/15-sql-functions/60-conversion-functions/index.md +++ b/docs/doc/15-sql-functions/60-conversion-functions/index.md @@ -27,7 +27,7 @@ Databend also offers a variety of functions for converting expressions into diff | TO_INT32( expr ) | Converts a value to INT32 data type | TO_INT32('123') | 123 | | TO_INT64( expr ) | Converts a value to INT64 data type | TO_INT64('123') | 123 | | TO_STRING( expr ) | Converts a value to STRING data type | TO_STRING(10) | 10 | -| TO_STRING( expr, expr ) | Converts a date value to a specific STRING format | TO_STRING('2022-12-25', 'Month/Day/Year: %m/%d/%Y') | Month/Day/Year: 12/25/2022 | +| TO_STRING( expr, expr ) | Alias for [DATE_FORMAT](../30-datetime-functions/dateformat.md) | TO_STRING('2022-12-25', 'Month/Day/Year: %m/%d/%Y') | Month/Day/Year: 12/25/2022 | | TO_UINT8( expr ) | Converts a value to UINT8 data type | TO_UINT8('123') | 123 | | TO_UINT16( expr ) | Converts a value to UINT16 data type | TO_UINT16('123') | 123 | | TO_UINT32( expr ) | Converts a value to UINT32 data type | TO_UINT32('123') | 123 |