Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Doc] add doc for time_format #54300

Merged
merged 4 commits into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
```
Loading