Skip to content

Commit

Permalink
docs: date_format (#11774)
Browse files Browse the repository at this point in the history
* added

* Update dateformat.md
  • Loading branch information
soyeric128 authored Jun 16, 2023
1 parent f428a39 commit c7c4f1c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
31 changes: 31 additions & 0 deletions docs/doc/15-sql-functions/30-datetime-functions/dateformat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
title: DATE_FORMAT
---

import FunctionDescription from '@site/src/components/FunctionDescription';

<FunctionDescription description="Introduced: v1.1.39"/>

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(<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 |
+-------------------------------------------------------+
```
2 changes: 1 addition & 1 deletion docs/doc/15-sql-functions/60-conversion-functions/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down

1 comment on commit c7c4f1c

@vercel
Copy link

@vercel vercel bot commented on c7c4f1c Jun 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

databend – ./

databend-git-main-databend.vercel.app
databend-databend.vercel.app
databend.rs
databend.vercel.app

Please sign in to comment.