-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Co-authored-by: stdpain <[email protected]>
- Loading branch information
1 parent
7341cd5
commit f216698
Showing
2 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
docs/en/sql-reference/sql-functions/date-time-functions/time_format.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
``` |
43 changes: 43 additions & 0 deletions
43
docs/zh/sql-reference/sql-functions/date-time-functions/time_format.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
``` |