1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 #include <file/fcode.hxx>
24 namespace connectivity::file
27 Returns the weekday index for date (1 = Sunday, 2 = Monday, ... 7 = Saturday). These index values correspond to the ODBC standard.
29 > SELECT DAYOFWEEK('1998-02-03');
32 class OOp_DayOfWeek
: public OUnaryOperator
35 virtual ORowSetValue
operate(const ORowSetValue
& lhs
) const override
;
39 Returns the day of the month for date, in the range 1 to 31:
41 > SELECT DAYOFMONTH('1998-02-03');
44 class OOp_DayOfMonth
: public OUnaryOperator
47 virtual ORowSetValue
operate(const ORowSetValue
& lhs
) const override
;
51 Returns the day of the year for date, in the range 1 to 366:
53 > SELECT DAYOFYEAR('1998-02-03');
57 class OOp_DayOfYear
: public OUnaryOperator
60 virtual ORowSetValue
operate(const ORowSetValue
& lhs
) const override
;
64 Returns the month for date, in the range 1 to 12:
66 > SELECT MONTH('1998-02-03');
69 class OOp_Month
: public OUnaryOperator
72 virtual ORowSetValue
operate(const ORowSetValue
& lhs
) const override
;
76 Returns the name of the weekday for date:
78 > SELECT DAYNAME('1998-02-05');
82 class OOp_DayName
: public OUnaryOperator
85 virtual ORowSetValue
operate(const ORowSetValue
& lhs
) const override
;
89 Returns the name of the month for date:
91 > SELECT MONTHNAME('1998-02-05');
95 class OOp_MonthName
: public OUnaryOperator
98 virtual ORowSetValue
operate(const ORowSetValue
& lhs
) const override
;
102 Returns the quarter of the year for date, in the range 1 to 4:
104 > SELECT QUARTER('98-04-01');
108 class OOp_Quarter
: public OUnaryOperator
111 virtual ORowSetValue
operate(const ORowSetValue
& lhs
) const override
;
116 With a single argument, returns the week for date, in the range 0 to 53 (yes, there may be the beginnings of a week 53), for locations where Sunday is the first day of the week. The two-argument form of WEEK() allows you to specify whether the week starts on Sunday or Monday and whether the return value should be in the range 0-53 or 1-52. Here is a table for how the second argument works:
118 0 Week starts on Sunday and return value is in range 0-53
119 1 Week starts on Monday and return value is in range 0-53
120 2 Week starts on Sunday and return value is in range 1-53
121 3 Week starts on Monday and return value is in range 1-53 (ISO 8601)
123 > SELECT WEEK('1998-02-20');
125 > SELECT WEEK('1998-02-20',0);
127 > SELECT WEEK('1998-02-20',1);
129 > SELECT WEEK('1998-12-31',1);
133 class OOp_Week
: public ONthOperator
136 virtual ORowSetValue
operate(const std::vector
<ORowSetValue
>& lhs
) const override
;
140 Returns the year for date, in the range 1000 to 9999:
142 > SELECT YEAR('98-02-03');
145 class OOp_Year
: public OUnaryOperator
148 virtual ORowSetValue
operate(const ORowSetValue
& lhs
) const override
;
152 Returns the hour for time, in the range 0 to 23:
154 > SELECT HOUR('10:05:03');
157 class OOp_Hour
: public OUnaryOperator
160 virtual ORowSetValue
operate(const ORowSetValue
& lhs
) const override
;
164 Returns the minute for time, in the range 0 to 59:
166 > SELECT MINUTE('98-02-03 10:05:03');
170 class OOp_Minute
: public OUnaryOperator
173 virtual ORowSetValue
operate(const ORowSetValue
& lhs
) const override
;
177 Returns the second for time, in the range 0 to 59:
179 > SELECT SECOND('10:05:03');
182 class OOp_Second
: public OUnaryOperator
185 virtual ORowSetValue
operate(const ORowSetValue
& lhs
) const override
;
190 Returns today's date as a value in 'YYYY-MM-DD' or YYYYMMDD format, depending on whether the function is used in a string or numeric context:
195 class OOp_CurDate
: public ONthOperator
198 virtual ORowSetValue
operate(const std::vector
<ORowSetValue
>& lhs
) const override
;
203 Returns the current time as a value in 'HH:MM:SS' or HHMMSS format, depending on whether the function is used in a string or numeric context:
208 class OOp_CurTime
: public ONthOperator
211 virtual ORowSetValue
operate(const std::vector
<ORowSetValue
>& lhs
) const override
;
215 Returns the current date and time as a value in 'YYYY-MM-DD HH:MM:SS' or YYYYMMDDHHMMSS format, depending on whether the function is used in a string or numeric context:
218 -> '1997-12-15 23:50:26'
220 class OOp_Now
: public ONthOperator
223 virtual ORowSetValue
operate(const std::vector
<ORowSetValue
>& lhs
) const override
;
228 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */