Skip to content

Commit

Permalink
[Doc] add doc for time_format (#54300)
Browse files Browse the repository at this point in the history
Signed-off-by: stdpain <[email protected]>
Signed-off-by: 絵空事スピリット <[email protected]>
Co-authored-by: 絵空事スピリット <[email protected]>
  • Loading branch information
stdpain and EsoragotoSpirit authored Jan 3, 2025
1 parent f43707f commit 387fffc
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
displayed_sidebar: docs
---

# time_format



Formats TIME-type values in the specified format.

## Syntax

```Haskell
VARCHAR TIME_FORMAT(TIME time, VARCHAR format)
```

## Parameters

- `time` (Required): The time value (of the TIME type) to be formatted.
- `format` (Required): The format to use. Valid values:

```Plain Text
%f Microseconds (000000 to 999999)
%H Hour (00 to 23)
%h Hour (00 to 12)
%i Minutes (00 to 59)
%p AM or PM
%S Seconds (00 to 59)
%s Seconds (00 to 59)
```

## Examples

```Plain Text
mysql> SELECT TIME_FORMAT("19:30:10", "%h %i %s %p");
+----------------------------------------+
| time_format('19:30:10', '%h %i %s %p') |
+----------------------------------------+
| 12 00 00 AM |
+----------------------------------------+
1 row in set (0.01 sec)
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
displayed_sidebar: docs
---

# time_format



按指定格式格式化 TIME 类型时间值。

## 语法

```Haskell
VARCHAR TIME_FORMAT(TIME time, VARCHAR format)
```

## 参数说明

- `time`(必须):待格式化的 TIME 类型时间值。
- `format`(必须):要使用的输出格式。有效值:

```Plain Text
%f Microseconds (000000 至 999999)
%H Hour (00 至 23)
%h Hour (00 至 12)
%i Minutes (00 至 59)
%p AM or PM
%S Seconds (00 至 59)
%s Seconds (00 至 59)
```


## 示例

```Plain Text
mysql> SELECT TIME_FORMAT("19:30:10", "%h %i %s %p");
+----------------------------------------+
| time_format('19:30:10', '%h %i %s %p') |
+----------------------------------------+
| 12 00 00 AM |
+----------------------------------------+
1 row in set (0.01 sec)
```

0 comments on commit 387fffc

Please sign in to comment.