aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/udfs/common/datetime2/test/cases/BlockTmGet.sql
blob: 3087d4e78d4db5e2297c2c2b382c45672259b914 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* syntax version 1 */
pragma UseBlocks;
insert into @t
    select
        cast(ftztimestamp as TzTimestamp) as `tm`,
    from Input;

commit;

SELECT
    DateTime::GetYear(tm) as ryear,
    DateTime::GetDayOfYear(tm) as rdayofyear,
    DateTime::GetMonth(tm) as rmonth,
    DateTime::GetMonthName(tm) as rmonthname,
    DateTime::GetWeekOfYear(tm) as rweekofyear,
    DateTime::GetWeekOfYearIso8601(tm) as rweekofyeariso8601,
    DateTime::GetDayOfMonth(tm) as rdayofmonth,
    DateTime::GetDayOfWeek(tm) as rdayofweek,
    DateTime::GetDayOfWeekName(tm) as rdayofweekname,
    DateTime::GetHour(tm) as rhour,
    DateTime::GetMinute(tm) as rminute,
    DateTime::GetSecond(tm) as rsecond,
    DateTime::GetMillisecondOfSecond(tm) as rmsec,
    DateTime::GetMicrosecondOfSecond(tm) as rusec,
    DateTime::GetTimezoneId(tm) as rtz,
    DateTime::GetTimezoneName(tm) as rtzname
FROM @t;