bump product version to 5.0.4.1
[LibreOffice.git] / connectivity / source / inc / file / FDateFunctions.hxx
blob871491a8b9f3c705ad8ccfa548f7575e695ffd26
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 #ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FDATEFUNCTIONS_HXX
21 #define INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FDATEFUNCTIONS_HXX
23 #include "file/fcode.hxx"
24 #include "file/filedllapi.hxx"
26 namespace connectivity
28 namespace file
30 /** DAYOFWEEK(date)
31 Returns the weekday index for date (1 = Sunday, 2 = Monday, ... 7 = Saturday). These index values correspond to the ODBC standard.
33 > SELECT DAYOFWEEK('1998-02-03');
34 -> 3
36 class OOp_DayOfWeek : public OUnaryOperator
38 protected:
39 virtual ORowSetValue operate(const ORowSetValue& lhs) const SAL_OVERRIDE;
42 /** DAYOFMONTH(date)
43 Returns the day of the month for date, in the range 1 to 31:
45 > SELECT DAYOFMONTH('1998-02-03');
46 -> 3
48 class OOp_DayOfMonth : public OUnaryOperator
50 protected:
51 virtual ORowSetValue operate(const ORowSetValue& lhs) const SAL_OVERRIDE;
54 /** DAYOFYEAR(date)
55 Returns the day of the year for date, in the range 1 to 366:
57 > SELECT DAYOFYEAR('1998-02-03');
58 -> 34
61 class OOp_DayOfYear : public OUnaryOperator
63 protected:
64 virtual ORowSetValue operate(const ORowSetValue& lhs) const SAL_OVERRIDE;
67 /** MONTH(date)
68 Returns the month for date, in the range 1 to 12:
70 > SELECT MONTH('1998-02-03');
71 -> 2
73 class OOp_Month : public OUnaryOperator
75 protected:
76 virtual ORowSetValue operate(const ORowSetValue& lhs) const SAL_OVERRIDE;
79 /** DAYNAME(date)
80 Returns the name of the weekday for date:
82 > SELECT DAYNAME('1998-02-05');
83 -> 'Thursday'
86 class OOp_DayName : public OUnaryOperator
88 protected:
89 virtual ORowSetValue operate(const ORowSetValue& lhs) const SAL_OVERRIDE;
92 /** MONTHNAME(date)
93 Returns the name of the month for date:
95 > SELECT MONTHNAME('1998-02-05');
96 -> 'February'
99 class OOp_MonthName : public OUnaryOperator
101 protected:
102 virtual ORowSetValue operate(const ORowSetValue& lhs) const SAL_OVERRIDE;
105 /** QUARTER(date)
106 Returns the quarter of the year for date, in the range 1 to 4:
108 > SELECT QUARTER('98-04-01');
109 -> 2
112 class OOp_Quarter : public OUnaryOperator
114 protected:
115 virtual ORowSetValue operate(const ORowSetValue& lhs) const SAL_OVERRIDE;
118 /** WEEK(date)
119 WEEK(date,first)
120 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:
121 Value Meaning
122 0 Week starts on Sunday and return value is in range 0-53
123 1 Week starts on Monday and return value is in range 0-53
124 2 Week starts on Sunday and return value is in range 1-53
125 3 Week starts on Monday and return value is in range 1-53 (ISO 8601)
127 > SELECT WEEK('1998-02-20');
128 -> 7
129 > SELECT WEEK('1998-02-20',0);
130 -> 7
131 > SELECT WEEK('1998-02-20',1);
132 -> 8
133 > SELECT WEEK('1998-12-31',1);
134 -> 53
137 class OOp_Week : public ONthOperator
139 protected:
140 virtual ORowSetValue operate(const ::std::vector<ORowSetValue>& lhs) const SAL_OVERRIDE;
143 /** YEAR(date)
144 Returns the year for date, in the range 1000 to 9999:
146 > SELECT YEAR('98-02-03');
147 -> 1998
149 class OOp_Year : public OUnaryOperator
151 protected:
152 virtual ORowSetValue operate(const ORowSetValue& lhs) const SAL_OVERRIDE;
155 /** HOUR(time)
156 Returns the hour for time, in the range 0 to 23:
158 > SELECT HOUR('10:05:03');
159 -> 10
161 class OOp_Hour : public OUnaryOperator
163 protected:
164 virtual ORowSetValue operate(const ORowSetValue& lhs) const SAL_OVERRIDE;
167 /** MINUTE(time)
168 Returns the minute for time, in the range 0 to 59:
170 > SELECT MINUTE('98-02-03 10:05:03');
171 -> 5
174 class OOp_Minute : public OUnaryOperator
176 protected:
177 virtual ORowSetValue operate(const ORowSetValue& lhs) const SAL_OVERRIDE;
180 /** SECOND(time)
181 Returns the second for time, in the range 0 to 59:
183 > SELECT SECOND('10:05:03');
184 -> 3
186 class OOp_Second : public OUnaryOperator
188 protected:
189 virtual ORowSetValue operate(const ORowSetValue& lhs) const SAL_OVERRIDE;
192 /** CURDATE()
193 CURRENT_DATE
194 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:
196 > SELECT CURDATE();
197 -> '1997-12-15'
199 class OOp_CurDate : public ONthOperator
201 protected:
202 virtual ORowSetValue operate(const ::std::vector<ORowSetValue>& lhs) const SAL_OVERRIDE;
205 /** CURTIME()
206 CURRENT_TIME
207 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:
209 > SELECT CURTIME();
210 -> '23:50:26'
212 class OOp_CurTime : public ONthOperator
214 protected:
215 virtual ORowSetValue operate(const ::std::vector<ORowSetValue>& lhs) const SAL_OVERRIDE;
218 /** NOW()
219 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:
221 > SELECT NOW();
222 -> '1997-12-15 23:50:26'
224 class OOp_Now : public ONthOperator
226 protected:
227 virtual ORowSetValue operate(const ::std::vector<ORowSetValue>& lhs) const SAL_OVERRIDE;
232 #endif // INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FDATEFUNCTIONS_HXX
234 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */