LAST_DAY(Lakehouse v1)
指定した日付またはタイムスタンプに基づいて、指定した間隔(週、月、四半期、または年)の最終日を返します。
Analyze 構文
Section titled “Analyze 構文”func.last_day(<date_expression>, <interval>)Analyze の例
Section titled “Analyze の例”func.last_day(func.to_date('2024-11-13'), 'month')┌──────────────────────────────────────────────────────┐│ func.last_day(func.to_date('2024-11-13'), 'month') │├──────────────────────────────────────────────────────┤│ 2024-11-30 │└──────────────────────────────────────────────────────┘SQL 構文
Section titled “SQL 構文”LAST_DAY(<date_expression>, <interval>)| パラメーター | 説明 |
|---|---|
<date_expression> |
指定した間隔の最終日を計算する対象の DATE または TIMESTAMP の値です。 |
<interval> |
最終日を求める間隔の種類です。指定できる値は week、month、quarter、year です。 |
日付。
SQL の例
Section titled “SQL の例”取引の任意の日付(例:2024-11-13)に基づいて、常に月末である請求日を求めるとします。
SELECT LAST_DAY(to_date('2024-11-13'), month) AS billing_date;
┌──────────────┐│ billing_date │├──────────────┤│ 2024-11-30 │└──────────────┘