Skip to content

Commit bc804d1

Browse files
committed
jh-v4-fix-unix-stamp
1 parent e64ba83 commit bc804d1

File tree

6 files changed

+30
-27
lines changed
  • docs/sql-manual/sql-functions/scalar-functions/date-time-functions
  • i18n/zh-CN/docusaurus-plugin-content-docs
    • current/sql-manual/sql-functions/scalar-functions/date-time-functions
    • version-2.1/sql-manual/sql-functions/scalar-functions/date-time-functions
    • version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions
  • versioned_docs
    • version-2.1/sql-manual/sql-functions/scalar-functions/date-time-functions
    • version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions

6 files changed

+30
-27
lines changed

docs/sql-manual/sql-functions/scalar-functions/date-time-functions/unix-timestamp.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ UNIX_TIMESTAMP([DATETIME date[, STRING fmt]])
2828

2929
| Paramters | Description |
3030
| -- | -- |
31-
| `<date>` | The datetime value to be converted is of type `datetime`, with a convertible range from '1970-01-01 00:00:01.000000 UTC' to '3001-01-19 03:14:07.999999 UTC'.|
31+
| `<date>` | The datetime value to be converted is of type `datetime` or `date` type, with a convertible range from '1970-01-01 00:00:01.000000 UTC' to '3001-01-19 03:14:07.999999 UTC'.|
3232
| `<fmt>` | The 'date' parameter refers to the specific part that needs to be converted into a timestamp, and it is a parameter of type string. If this parameter is provided, only the part matching the format will be converted into a timestamp. |
3333

3434
## Return value
3535
Returns two types based on the input:
3636

37-
- If the input datetime scale is not 0 or a format parameter is provided,
37+
- If the input `date`(only `datetime` type have the scale not zero) scale is not 0 or a format parameter is provided,
3838
returns a timestamp of type Decimal with a maximum precision of six decimal places.
3939
- If the input datetime scale is 0 and no format parameter is provided,
4040
returns a timestamp of type INT.

i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/unix-timestamp.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,21 @@ UNIX_TIMESTAMP([DATETIME date[, STRING fmt]])
2828

2929
| 参数 | 描述 |
3030
| -- | -- |
31-
| `<date>` | 待转换的日期时间值,类型为 `datetime`,可转换范围为 '1970-01-01 00:00:01.000000 UTC' 至 '3001-01-19 03:14:07.999999 UTC'。|
31+
| `<date>` | 待转换的日期时间值,类型为 `datetime``date` 类型,可转换范围为 '1970-01-01 00:00:01.000000 UTC' 至 '3001-01-19 03:14:07.999999 UTC'。|
3232
| `<fmt>` | date 参数指代需要转换为时间戳的特定部分,其类型为 `string`。若提供该参数,则仅将与格式匹配的部分转换为时间戳。 |
3333

3434
## 返回值
3535
根据输入返回两种类型
36-
1.若是输入的 datetime scale 不为0 或者带有 format 参数
36+
37+
1.若是输入的 `date` (只有 datetime 类型才可以有 scale 不为零) scale 不为 0 或者带有 `format` 参数
3738
返回一个时间戳,类型为 Decimal,最高六位小数精度
3839

39-
2.若是输入的 datetime scale 为0 并且不带有 format 参数
40+
2.若是输入的 `date` scale 为 0 并且不带有 `format` 参数
4041
返回一个时间戳,类型为 INT
4142

4243
对于在 1970-01-01 00:00:01.000000 UTC 之前或 3001-01-19 03:14:07.999999 UTC 之后的时间,该函数将返回 0。
4344

44-
任意参数为null则返回null
45+
任意参数为 null 则返回 null
4546

4647
## 举例
4748

@@ -93,7 +94,7 @@ mysql> select unix_timestamp('2007-11-30 10:30%3A19', '%Y-%m-%d %H:%i%%3A%s');
9394
+-----------------------------------------------------------------+
9495

9596

96-
---超出最小范围内的时间返回0
97+
---超出最小范围内的时间返回 0
9798
mysql> SELECT UNIX_TIMESTAMP('1970-01-01 00:00:00');
9899
+---------------------------------------+
99100
| UNIX_TIMESTAMP('1970-01-01 00:00:00') |
@@ -102,7 +103,7 @@ mysql> SELECT UNIX_TIMESTAMP('1970-01-01 00:00:00');
102103
+---------------------------------------+
103104

104105

105-
---输入时间并且 scale 不为0
106+
---输入时间并且 scale 不为 0
106107
mysql> SELECT UNIX_TIMESTAMP('2015-11-13 10:20:19.123');
107108
+-------------------------------------------+
108109
| UNIX_TIMESTAMP('2015-11-13 10:20:19.123') |
@@ -120,7 +121,7 @@ mysql> SELECT UNIX_TIMESTAMP('3001-01-19 03:14:07.999999');
120121
+----------------------------------------------+
121122

122123

123-
---任意参数为null则返回Null
124+
---任意参数为 null 则返回 Null
124125
mysql> select unix_timestamp(NULL);
125126
+----------------------+
126127
| unix_timestamp(NULL) |

i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/date-time-functions/unix-timestamp.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,21 @@ UNIX_TIMESTAMP([DATETIME date[, STRING fmt]])
2828

2929
| 参数 | 描述 |
3030
| -- | -- |
31-
| `<date>` | 待转换的日期时间值,类型为 `datetime`,可转换范围为 '1970-01-01 00:00:01.000000 UTC' 至 '3001-01-19 03:14:07.999999 UTC'。|
31+
| `<date>` | 待转换的日期时间值,类型为 `datetime``date` 类型,可转换范围为 '1970-01-01 00:00:01.000000 UTC' 至 '3001-01-19 03:14:07.999999 UTC'。|
3232
| `<fmt>` | date 参数指代需要转换为时间戳的特定部分,其类型为 `string`。若提供该参数,则仅将与格式匹配的部分转换为时间戳。 |
3333

3434
## 返回值
3535
根据输入返回两种类型
36-
1.若是输入的 datetime scale 不为0 或者带有 format 参数
36+
37+
1.若是输入的 `date` (只有 datetime 类型才可以有 scale 不为零) scale 不为 0 或者带有 `format` 参数
3738
返回一个时间戳,类型为 Decimal,最高六位小数精度
3839

39-
2.若是输入的 datetime scale 为0 并且不带有 format 参数
40+
2.若是输入的 `date` scale 为 0 并且不带有 `format` 参数
4041
返回一个时间戳,类型为 INT
4142

4243
对于在 1970-01-01 00:00:01.000000 UTC 之前或 3001-01-19 03:14:07.999999 UTC 之后的时间,该函数将返回 0。
4344

44-
任意参数为null则返回null
45+
任意参数为 null 则返回 null
4546

4647
## 举例
4748

@@ -93,7 +94,7 @@ mysql> select unix_timestamp('2007-11-30 10:30%3A19', '%Y-%m-%d %H:%i%%3A%s');
9394
+-----------------------------------------------------------------+
9495

9596

96-
---超出最小范围内的时间返回0
97+
---超出最小范围内的时间返回 0
9798
mysql> SELECT UNIX_TIMESTAMP('1970-01-01 00:00:00');
9899
+---------------------------------------+
99100
| UNIX_TIMESTAMP('1970-01-01 00:00:00') |
@@ -102,7 +103,7 @@ mysql> SELECT UNIX_TIMESTAMP('1970-01-01 00:00:00');
102103
+---------------------------------------+
103104

104105

105-
---输入时间并且 scale 不为0
106+
---输入时间并且 scale 不为 0
106107
mysql> SELECT UNIX_TIMESTAMP('2015-11-13 10:20:19.123');
107108
+-------------------------------------------+
108109
| UNIX_TIMESTAMP('2015-11-13 10:20:19.123') |
@@ -120,7 +121,7 @@ mysql> SELECT UNIX_TIMESTAMP('3001-01-19 03:14:07.999999');
120121
+----------------------------------------------+
121122

122123

123-
---任意参数为null则返回Null
124+
---任意参数为 null 则返回 Null
124125
mysql> select unix_timestamp(NULL);
125126
+----------------------+
126127
| unix_timestamp(NULL) |

i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/unix-timestamp.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,21 @@ UNIX_TIMESTAMP([DATETIME date[, STRING fmt]])
2828

2929
| 参数 | 描述 |
3030
| -- | -- |
31-
| `<date>` | 待转换的日期时间值,类型为 `datetime`,可转换范围为 '1970-01-01 00:00:01.000000 UTC' 至 '3001-01-19 03:14:07.999999 UTC'。|
31+
| `<date>` | 待转换的日期时间值,类型为 `datetime``date` 类型,可转换范围为 '1970-01-01 00:00:01.000000 UTC' 至 '3001-01-19 03:14:07.999999 UTC'。|
3232
| `<fmt>` | date 参数指代需要转换为时间戳的特定部分,其类型为 `string`。若提供该参数,则仅将与格式匹配的部分转换为时间戳。 |
3333

3434
## 返回值
3535
根据输入返回两种类型
36-
1.若是输入的 datetime scale 不为0 或者带有 format 参数
36+
37+
1.若是输入的 `date` (只有 datetime 类型才可以有 scale 不为零) scale 不为 0 或者带有 `format` 参数
3738
返回一个时间戳,类型为 Decimal,最高六位小数精度
3839

39-
2.若是输入的 datetime scale 为0 并且不带有 format 参数
40+
2.若是输入的 `date` scale 为 0 并且不带有 `format` 参数
4041
返回一个时间戳,类型为 INT
4142

4243
对于在 1970-01-01 00:00:01.000000 UTC 之前或 3001-01-19 03:14:07.999999 UTC 之后的时间,该函数将返回 0。
4344

44-
任意参数为null则返回null
45+
任意参数为 null 则返回 null
4546

4647
## 举例
4748

@@ -93,7 +94,7 @@ mysql> select unix_timestamp('2007-11-30 10:30%3A19', '%Y-%m-%d %H:%i%%3A%s');
9394
+-----------------------------------------------------------------+
9495

9596

96-
---超出最小范围内的时间返回0
97+
---超出最小范围内的时间返回 0
9798
mysql> SELECT UNIX_TIMESTAMP('1970-01-01 00:00:00');
9899
+---------------------------------------+
99100
| UNIX_TIMESTAMP('1970-01-01 00:00:00') |
@@ -102,7 +103,7 @@ mysql> SELECT UNIX_TIMESTAMP('1970-01-01 00:00:00');
102103
+---------------------------------------+
103104

104105

105-
---输入时间并且 scale 不为0
106+
---输入时间并且 scale 不为 0
106107
mysql> SELECT UNIX_TIMESTAMP('2015-11-13 10:20:19.123');
107108
+-------------------------------------------+
108109
| UNIX_TIMESTAMP('2015-11-13 10:20:19.123') |
@@ -120,7 +121,7 @@ mysql> SELECT UNIX_TIMESTAMP('3001-01-19 03:14:07.999999');
120121
+----------------------------------------------+
121122

122123

123-
---任意参数为null则返回Null
124+
---任意参数为 null 则返回 Null
124125
mysql> select unix_timestamp(NULL);
125126
+----------------------+
126127
| unix_timestamp(NULL) |

versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/date-time-functions/unix-timestamp.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ UNIX_TIMESTAMP([DATETIME date[, STRING fmt]])
2828

2929
| Paramters | Description |
3030
| -- | -- |
31-
| `<date>` | The datetime value to be converted is of type `datetime`, with a convertible range from '1970-01-01 00:00:01.000000 UTC' to '3001-01-19 03:14:07.999999 UTC'.|
31+
| `<date>` | The datetime value to be converted is of type `datetime` or `date` type, with a convertible range from '1970-01-01 00:00:01.000000 UTC' to '3001-01-19 03:14:07.999999 UTC'.|
3232
| `<fmt>` | The 'date' parameter refers to the specific part that needs to be converted into a timestamp, and it is a parameter of type string. If this parameter is provided, only the part matching the format will be converted into a timestamp. |
3333

3434
## Return value
3535
Returns two types based on the input:
3636

37-
- If the input datetime scale is not 0 or a format parameter is provided,
37+
- If the input `date`(only `datetime` type have the scale not zero) scale is not 0 or a format parameter is provided,
3838
returns a timestamp of type Decimal with a maximum precision of six decimal places.
3939
- If the input datetime scale is 0 and no format parameter is provided,
4040
returns a timestamp of type INT.

versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/unix-timestamp.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ UNIX_TIMESTAMP([DATETIME date[, STRING fmt]])
2828

2929
| Paramters | Description |
3030
| -- | -- |
31-
| `<date>` | The datetime value to be converted is of type `datetime`, with a convertible range from '1970-01-01 00:00:01.000000 UTC' to '3001-01-19 03:14:07.999999 UTC'.|
31+
| `<date>` | The datetime value to be converted is of type `datetime` or `date` type, with a convertible range from '1970-01-01 00:00:01.000000 UTC' to '3001-01-19 03:14:07.999999 UTC'.|
3232
| `<fmt>` | The 'date' parameter refers to the specific part that needs to be converted into a timestamp, and it is a parameter of type string. If this parameter is provided, only the part matching the format will be converted into a timestamp. |
3333

3434
## Return value
3535
Returns two types based on the input:
3636

37-
- If the input datetime scale is not 0 or a format parameter is provided,
37+
- If the input `date`(only `datetime` type have the scale not zero) scale is not 0 or a format parameter is provided,
3838
returns a timestamp of type Decimal with a maximum precision of six decimal places.
3939
- If the input datetime scale is 0 and no format parameter is provided,
4040
returns a timestamp of type INT.

0 commit comments

Comments
 (0)