-
Notifications
You must be signed in to change notification settings - Fork 753
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
82 additions
and
15 deletions.
There are no files selected for viewing
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
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
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
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
61 changes: 61 additions & 0 deletions
61
website/datafuse/docs/sqlstatement/datetime-functions/toyyyymmddhhmmss.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,61 @@ | ||
--- | ||
id: datetime-toyyyymmddhhmmss | ||
title: toYYYYMMDDhhmmss | ||
--- | ||
|
||
Converts a date or date with time to a UInt64 number containing the year and month number (YYYY * 10000000000 + MM * 100000000 + DD * 1000000 + hh * 10000 + mm * 100 + ss). | ||
## Syntax | ||
|
||
```sql | ||
toYYYYMMDDhhmmss(expr) | ||
``` | ||
|
||
## Return Type | ||
|
||
UInt64, returns in `YYYYMMDDhhmmss` format. | ||
|
||
## Examples | ||
|
||
``` | ||
mysql> select toDate(18875); | ||
+---------------+ | ||
| toDate(18875) | | ||
+---------------+ | ||
| 2021-09-05 | | ||
+---------------+ | ||
mysql> select toYYYYMMDDhhmmss(toDate(18875)); | ||
+---------------------------------+ | ||
| toYYYYMMDDhhmmss(toDate(18875)) | | ||
+---------------------------------+ | ||
| 20210905000000 | | ||
+---------------------------------+ | ||
mysql> select toTypeName(toYYYYMMDDhhmmss(toDate(18875))); | ||
+---------------------------------------------+ | ||
| toTypeName(toYYYYMMDDhhmmss(toDate(18875))) | | ||
+---------------------------------------------+ | ||
| UInt64 | | ||
+---------------------------------------------+ | ||
mysql> select toDateTime(1630833797); | ||
+------------------------+ | ||
| toDateTime(1630833797) | | ||
+------------------------+ | ||
| 2021-09-05 09:23:17 | | ||
+------------------------+ | ||
mysql> select toYYYYMMDDhhmmss(toDateTime(1630833797)); | ||
+------------------------------------------+ | ||
| toYYYYMMDDhhmmss(toDateTime(1630833797)) | | ||
+------------------------------------------+ | ||
| 20210905092317 | | ||
+------------------------------------------+ | ||
mysql> select toTypeName(toYYYYMMDDhhmmss(toDateTime(1630833797))); | ||
+------------------------------------------------------+ | ||
| toTypeName(toYYYYMMDDhhmmss(toDateTime(1630833797))) | | ||
+------------------------------------------------------+ | ||
| UInt64 | | ||
+------------------------------------------------------+ | ||
``` |