メインコンテンツまでスキップ
バージョン: Stable-3.5

quarters_add

指定された四半期数を日付に加えます。1 四半期は 3 か月に相当します。

Syntax

DATETIME quarters_add(DATETIME expr1, INT expr2);

Parameters

  • expr1: 開始時間。DATETIME または DATE 型である必要があります。

  • expr2: 加算する四半期数。INT 型である必要があります。0 より大きい、0 に等しい、または 0 より小さい値を取ることができます。負の値は expr1 から四半期を減算します。

Return value

DATETIME 値を返します。

Examples

select quarters_add('2019-08-01 13:21:03', 1);
+----------------------------------------+
| quarters_add('2019-08-01 13:21:03', 1) |
+----------------------------------------+
| 2019-11-01 13:21:03 |
+----------------------------------------+

select quarters_add('2019-08-01', 1);
+-------------------------------+
| quarters_add('2019-08-01', 1) |
+-------------------------------+
| 2019-11-01 00:00:00 |
+-------------------------------+

select quarters_add('2019-08-01 13:21:03', -1);
+-----------------------------------------+
| quarters_add('2019-08-01 13:21:03', -1) |
+-----------------------------------------+
| 2019-05-01 13:21:03 |
+-----------------------------------------+
Rocky the happy otterStarRocks Assistant

AI generated answers are based on docs and other sources. Please test answers in non-production environments.