Skip to main content

spreadsheet_ods_formula/generated/
date.rs

1
2use crate::*;
3#[allow(unused_imports)]
4use crate::date::*;
5
6/// Constructs a date from year, month, and day of month.
7///
8/// [documentfoundation->DATE](https://wiki.documentfoundation.org/Documentation/Calc_Functions/DATE)
9///
10/// __Syntax__: 
11/// ```ods
12///     DATE( Year: Integer; Month: Integer; Day: Integer )
13/// ```
14///
15/// __Constraints__:
16/// 1904 ≤ Year ≤ 9956; 1 ≤ Month ≤ 12; 1 ≤ Day ≤ 31; Evaluators 
17/// may evaluate expressions that do no meet this constraint.
18///
19/// __Semantics__:
20/// This computes the date's serial number given Year, Month, and Day of the 
21/// Gregorian calendar. Fractional values are truncated. Month > 12 and Day > 
22/// days of Month will roll over the date, computing the result by adding 
23/// months and days as necessary. The value of the serial number depends on the 
24/// current epoch.
25///
26/// __See also__: [crate::of::time()], [crate::of::datevalue()], 
27#[inline]
28pub fn date<A: Number, B: Number, C: Number>(year: A, month: B, day: C) -> FnNumber3<A, B, C> {
29    FnNumber3("DATE", year, month, day)
30}
31
32/// Returns the difference in years, months, or days of two date numbers.
33///
34/// [documentfoundation->DATEDIF](https://wiki.documentfoundation.org/Documentation/Calc_Functions/DATEDIF)
35///
36/// __Syntax__: 
37/// ```ods
38///     DATEDIF( StartDate: DateParam; EndDate: DateParam; Format: Text )
39/// ```
40///
41/// __Constraints__:
42/// None
43///
44/// __Semantics__:
45/// Compute difference of StartDate and EndDate, in the units given by Format.
46/// 
47/// The Format is a code from the following table, entered as text, that 
48/// specifies the format you want the result of DATEDIF to have.
49///
50/// __See also__: [crate::of::days360()], [crate::of::days()], [crate::of::infix operator “-”()], 
51#[inline]
52pub fn datedif<A: DateTime, B: DateTime>(start_date: A, end_date: B, format: DateDifMethod) -> FnNumber3<A, B, DateDifMethod> {
53    FnNumber3("DATEDIF", start_date, end_date, format)
54}
55
56/// Returns the date serial number from given text.
57///
58/// [documentfoundation->DATEVALUE](https://wiki.documentfoundation.org/Documentation/Calc_Functions/DATEVALUE)
59///
60/// __Syntax__: 
61/// ```ods
62///     DATEVALUE( D: Text )
63/// ```
64///
65/// __Constraints__:
66/// None
67///
68/// __Semantics__:
69/// This computes the serial number of the text string D, using the current 
70/// locale. This function shall accept ISO date format (YYYY-MM-DD), which is 
71/// locale-independent. It is semantically equal to VALUE(Date), if Date has a 
72/// date format, since text matching a date format is automatically converted 
73/// to a serial number when used as a Number. If the text of D has a combined 
74/// date and time format, e.g. YYYY-MM-DD HH:MM:SS, the integer part of the 
75/// date serial number is returned. If the text of D does not have a date or 
76/// time format, an evaluator may return an Error. See VALUE for more 
77/// information on date formats. The value of the serial number depends on the 
78/// current epoch.
79///
80/// __See also__: [crate::of::time()], [crate::of::date()], [crate::of::timevalue()], [crate::of::value()], 
81#[inline]
82pub fn datevalue<A: Text>(d: A) -> FnNumber1<A> {
83    FnNumber1("DATEVALUE", d)
84}
85
86/// Returns the day from a date.
87///
88/// [documentfoundation->DAY](https://wiki.documentfoundation.org/Documentation/Calc_Functions/DAY)
89///
90/// __Syntax__: 
91/// ```ods
92///     DAY( D: DateParam )
93/// ```
94///
95/// __Constraints__:
96/// None
97///
98/// __Semantics__:
99/// Returns the day portion of D.
100///
101/// __See also__: [crate::of::month()], [crate::of::year()], 
102#[inline]
103pub fn day<A: DateTime>(d: A) -> FnNumber1<A> {
104    FnNumber1("DAY", d)
105}
106
107/// Returns the number of days between two dates
108///
109/// [documentfoundation->DAYS](https://wiki.documentfoundation.org/Documentation/Calc_Functions/DAYS)
110///
111/// __Syntax__: 
112/// ```ods
113///     DAYS( EndDate: DateParam; StartDate: DateParam )
114/// ```
115///
116/// __Constraints__:
117/// None
118///
119/// __Semantics__:
120/// Returns the number of days between two dates. If StartDate and EndDate are 
121/// Numbers, this is EndDate – StartDate. If they are both Text, this is 
122/// DATEVALUE(StartDate) – DATEVALUE(EndDate).
123///
124/// __See also__: [crate::of::datedif()], [crate::of::datevalue()], [crate::of::days360()], [crate::of::month()], [crate::of::year()], [crate::of::infix operator “-”()], 
125#[inline]
126pub fn days<A: DateTime, B: DateTime>(end_date: A, start_date: B) -> FnNumber2<A, B> {
127    FnNumber2("DAYS", end_date, start_date)
128}
129
130/// Returns the number of days between two dates using the 360-day year
131///
132/// [documentfoundation->DAYS360](https://wiki.documentfoundation.org/Documentation/Calc_Functions/DAYS360)
133///
134/// __Syntax__: 
135/// ```ods
136///     DAYS360( StartDate: DateParam; EndDate: DateParam )
137/// ```
138///
139/// __Constraints__:
140/// None
141///
142/// __Semantics__:
143/// If Method is FALSE, it uses the National Association of Securities Dealers 
144/// (NASD) method, also known as the U.S. method. If Method is TRUE, the 
145/// European method is used.
146/// 
147/// The US/NASD method (30US/360):
148/// 
149/// 1.Truncate date values, set sign = 1.
150/// 
151/// 2.If StartDate's day-of-month is 31, it is changed to 30.
152/// 
153/// 3.Otherwise, if StartDate's day-of-month is the last day of February, it is 
154/// changed to 30.
155/// 
156/// 4.If EndDate's day-of-month is 31 and StartDate's day-of-month is 30 (after 
157/// having applied a change for #2 or #3, if necessary), EndDate's day-of-month 
158/// is changed to 30.
159/// 
160/// Note 1: This calculation is slightly different from Basis 0 (4.11.7 Basis). 
161/// Dates are never swapped.
162/// 
163/// The European method (30E/360):
164/// 
165/// 1.Truncate date values, set sign = 1.
166/// 
167/// 2.If StartDate is after EndDate then swap dates and set sign = -1.
168/// 
169/// 3.If StartDate's day-of-month is 31, it is changed to 30.
170/// 
171/// 4.If EndDate's day-of-month is 31, it is changed to 30.
172/// 
173/// Note 2: Days in February are never changed.
174/// 
175/// Note 3: This calculation is identical to Basis 4 (4.11.7 Basis)
176/// 
177/// For both methods the value then returned is
178/// sign * ((EndDate.year * 360 + EndDate.month * 30 + EndDate.day) – 
179/// (StartDate.year * 360 + StartDate.month * 30 + StartDate.day))
180///
181/// __See also__: [crate::of::days()], [crate::of::datedif()], [crate::of::days360_()], 
182#[inline]
183pub fn days360<A: DateTime, B: DateTime>(start_date: A, end_date: B) -> FnNumber2<A, B> {
184    FnNumber2("DAYS360", start_date, end_date)
185}
186
187/// Returns the number of days between two dates using the 360-day year
188///
189/// [documentfoundation->DAYS360](https://wiki.documentfoundation.org/Documentation/Calc_Functions/DAYS360)
190///
191/// __Syntax__: 
192/// ```ods
193///     DAYS360( StartDate: DateParam; EndDate: DateParam; Method: Logical )
194/// ```
195///
196/// __Constraints__:
197/// None
198///
199/// __Semantics__:
200/// If Method is FALSE, it uses the National Association of Securities Dealers 
201/// (NASD) method, also known as the U.S. method. If Method is TRUE, the 
202/// European method is used.
203/// 
204/// The US/NASD method (30US/360):
205/// 
206/// 1.Truncate date values, set sign = 1.
207/// 
208/// 2.If StartDate's day-of-month is 31, it is changed to 30.
209/// 
210/// 3.Otherwise, if StartDate's day-of-month is the last day of February, it is 
211/// changed to 30.
212/// 
213/// 4.If EndDate's day-of-month is 31 and StartDate's day-of-month is 30 (after 
214/// having applied a change for #2 or #3, if necessary), EndDate's day-of-month 
215/// is changed to 30.
216/// 
217/// Note 1: This calculation is slightly different from Basis 0 (4.11.7 Basis). 
218/// Dates are never swapped.
219/// 
220/// The European method (30E/360):
221/// 
222/// 1.Truncate date values, set sign = 1.
223/// 
224/// 2.If StartDate is after EndDate then swap dates and set sign = -1.
225/// 
226/// 3.If StartDate's day-of-month is 31, it is changed to 30.
227/// 
228/// 4.If EndDate's day-of-month is 31, it is changed to 30.
229/// 
230/// Note 2: Days in February are never changed.
231/// 
232/// Note 3: This calculation is identical to Basis 4 (4.11.7 Basis)
233/// 
234/// For both methods the value then returned is
235/// sign * ((EndDate.year * 360 + EndDate.month * 30 + EndDate.day) – 
236/// (StartDate.year * 360 + StartDate.month * 30 + StartDate.day))
237///
238/// __See also__: [crate::of::days()], [crate::of::datedif()], [crate::of::days360()], 
239#[inline]
240pub fn days360_<A: DateTime, B: DateTime>(start_date: A, end_date: B, method: Days360Method) -> FnNumber3<A, B, Days360Method> {
241    FnNumber3("DAYS360", start_date, end_date, method)
242}
243
244/// Returns the serial number of a given date when MonthAdd months is added
245///
246/// [documentfoundation->EDATE](https://wiki.documentfoundation.org/Documentation/Calc_Functions/EDATE)
247///
248/// __Syntax__: 
249/// ```ods
250///     EDATE( StartDate: DateParam; MonthAdd: Number )
251/// ```
252///
253/// __Constraints__:
254/// None
255///
256/// __Semantics__:
257/// First truncate StartDate and MonthAdd, then add MonthAdd number of months. 
258/// MonthAdd can be positive, negative, or 0; if zero, the number representing 
259/// StartDate (in the current epoch) is returned.
260/// 
261/// If after adding the given number of months, the day of month in the new 
262/// month is larger than the number of days in the given month, the day of 
263/// month is adjusted to the last day of the new month. Then the serial number 
264/// of that date is returned.
265///
266/// __See also__: [crate::of::days()], [crate::of::datedif()], [crate::of::eomonth()], 
267#[inline]
268pub fn edate<A: DateTime, B: Number>(start_date: A, month_add: B) -> FnNumber2<A, B> {
269    FnNumber2("EDATE", start_date, month_add)
270}
271
272/// Returns the serial number of the end of a month, given date plus MonthAdd 
273/// months
274///
275/// [documentfoundation->EOMONTH](https://wiki.documentfoundation.org/Documentation/Calc_Functions/EOMONTH)
276///
277/// __Syntax__: 
278/// ```ods
279///     EOMONTH( StartDate: DateParam; MonthAdd: Integer )
280/// ```
281///
282/// __Constraints__:
283/// None
284///
285/// __Semantics__:
286/// First truncate StartDate and MonthAdd, then add MonthAdd number of months. 
287/// MonthAdd can be positive, negative, or 0. Then return the serial number 
288/// representing the end of that month. Due to the semantics of this function, 
289/// the value of DAY(StartDate) is irrelevant.
290///
291/// __See also__: [crate::of::day()], [crate::of::edate()], 
292#[inline]
293pub fn eomonth<A: DateTime, B: Number>(start_date: A, month_add: B) -> FnNumber2<A, B> {
294    FnNumber2("EOMONTH", start_date, month_add)
295}
296
297/// Extracts the hour (0 through 23) from a time.
298///
299/// [documentfoundation->HOUR](https://wiki.documentfoundation.org/Documentation/Calc_Functions/HOUR)
300///
301/// __Syntax__: 
302/// ```ods
303///     HOUR( T: TimeParam )
304/// ```
305///
306/// __Constraints__:
307/// None
308///
309/// __Semantics__:
310/// Extract from T the hour value, 0 through 23, as per a 24-hour clock. This 
311/// is equal to:
312/// 
313/// DayFraction = (T - INT(T))
314/// 
315/// Hour = INT(DayFraction * 24)
316///
317/// __See also__: [crate::of::month()], [crate::of::day()], [crate::of::minute()], [crate::of::second()], [crate::of::int()], 
318#[inline]
319pub fn hour<A: DateTime>(t: A) -> FnNumber1<A> {
320    FnNumber1("HOUR", t)
321}
322
323/// Determines the ISO week number of the year for a given date.
324///
325/// [documentfoundation->ISOWEEKNUM](https://wiki.documentfoundation.org/Documentation/Calc_Functions/ISOWEEKNUM)
326///
327/// __Syntax__: 
328/// ```ods
329///     ISOWEEKNUM( D: DateParam )
330/// ```
331///
332/// __Constraints__:
333/// None
334///
335/// __Semantics__:
336/// Returns the ordinal number of the ISO8601 calendar week in the year for the 
337/// given date D. ISO 8601 defines the calendar week as a time interval of 
338/// seven calendar days starting with a Monday, and the first calendar week of 
339/// a year as the one that includes the first Thursday of that year.
340///
341/// __See also__: [crate::of::day()], [crate::of::month()], [crate::of::year()], [crate::of::weekday()], [crate::of::weeknum()], 
342#[inline]
343pub fn isoweeknum<A: DateTime>(d: A) -> FnNumber1<A> {
344    FnNumber1("ISOWEEKNUM", d)
345}
346
347/// Extracts the minute (0 through 59) from a time.
348///
349/// [documentfoundation->MINUTE](https://wiki.documentfoundation.org/Documentation/Calc_Functions/MINUTE)
350///
351/// __Syntax__: 
352/// ```ods
353///     MINUTE( T: TimeParam )
354/// ```
355///
356/// __Constraints__:
357/// None
358///
359/// __Semantics__:
360/// Extract from T the minute value, 0 through 59, as per a clock. This is 
361/// equal to:
362/// 
363/// DayFraction = (T - INT(T))
364/// 
365/// HourFraction = (DayFraction * 24 - INT(DayFraction * 24))
366/// 
367/// Minute = INT(HourFraction * 60)
368///
369/// __See also__: [crate::of::month()], [crate::of::day()], [crate::of::hour()], [crate::of::second()], [crate::of::int()], 
370#[inline]
371pub fn minute<A: DateTime>(t: A) -> FnNumber1<A> {
372    FnNumber1("MINUTE", t)
373}
374
375/// Extracts the month from a date.
376///
377/// [documentfoundation->MONTH](https://wiki.documentfoundation.org/Documentation/Calc_Functions/MONTH)
378///
379/// __Syntax__: 
380/// ```ods
381///     MONTH( Date: DateParam )
382/// ```
383///
384/// __Constraints__:
385/// None
386///
387/// __Semantics__:
388/// Takes Date and returns the month portion.
389///
390/// __See also__: [crate::of::year()], [crate::of::day()], 
391#[inline]
392pub fn month<A: DateTime>(date: A) -> FnNumber1<A> {
393    FnNumber1("MONTH", date)
394}
395
396/// Returns the whole number of work days between two dates.
397///
398/// [documentfoundation->NETWORKDAYS](https://wiki.documentfoundation.org/Documentation/Calc_Functions/NETWORKDAYS)
399///
400/// __Syntax__: 
401/// ```ods
402///     NETWORKDAYS( Date1: DateParam; Date2: DateParam )
403/// ```
404///
405/// __Constraints__:
406/// None
407///
408/// __Semantics__:
409/// Returns the whole number of work days between two dates.
410/// 
411/// Work days are defined as non-weekend, non-holiday days. By default, 
412/// weekends are Saturdays and Sundays and there are no holidays.
413/// 
414/// The optional 3rd parameter Holidays can be used to specify a list of dates 
415/// to be treated as holidays. Note that this parameter can be omitted as an 
416/// empty parameter (two consecutive ;; semicolons) to be able to pass the set 
417/// of Workdays without Holidays.
418/// 
419/// The optional 4th parameter Workdays can be used to specify a different 
420/// definition for the standard work week by passing in a list of numbers which 
421/// define which days of the week are workdays (indicated by 0) or not 
422/// (indicated by non-zero) in order Sunday, Monday,...,Saturday. So, the 
423/// default definition of the work week excludes Saturday and Sunday and is: 
424/// {1;0;0;0;0;0;1}. To define the work week as excluding Friday and Saturday, 
425/// the third parameter would be: {0;0;0;0;0;1;1}.
426///
427/// __See also__: [crate::of::networkdays_()], [crate::of::networkdays__()], 
428#[inline]
429pub fn networkdays<A: DateTime, B: DateTime>(date1: A, date2: B) -> FnNumber2<A, B> {
430    FnNumber2("NETWORKDAYS", date1, date2)
431}
432
433/// Returns the whole number of work days between two dates.
434///
435/// [documentfoundation->NETWORKDAYS](https://wiki.documentfoundation.org/Documentation/Calc_Functions/NETWORKDAYS)
436///
437/// __Syntax__: 
438/// ```ods
439///     NETWORKDAYS( Date1: DateParam; Date2: DateParam; Holidays: DateSequence )
440/// ```
441///
442/// __Constraints__:
443/// None
444///
445/// __Semantics__:
446/// Returns the whole number of work days between two dates.
447/// 
448/// Work days are defined as non-weekend, non-holiday days. By default, 
449/// weekends are Saturdays and Sundays and there are no holidays.
450/// 
451/// The optional 3rd parameter Holidays can be used to specify a list of dates 
452/// to be treated as holidays. Note that this parameter can be omitted as an 
453/// empty parameter (two consecutive ;; semicolons) to be able to pass the set 
454/// of Workdays without Holidays.
455/// 
456/// The optional 4th parameter Workdays can be used to specify a different 
457/// definition for the standard work week by passing in a list of numbers which 
458/// define which days of the week are workdays (indicated by 0) or not 
459/// (indicated by non-zero) in order Sunday, Monday,...,Saturday. So, the 
460/// default definition of the work week excludes Saturday and Sunday and is: 
461/// {1;0;0;0;0;0;1}. To define the work week as excluding Friday and Saturday, 
462/// the third parameter would be: {0;0;0;0;0;1;1}.
463///
464/// __See also__: [crate::of::networkdays()], [crate::of::networkdays__()], 
465#[inline]
466pub fn networkdays_<A: DateTime, B: DateTime, C: Sequence>(date1: A, date2: B, holidays: C) -> FnNumber3<A, B, C> {
467    FnNumber3("NETWORKDAYS", date1, date2, holidays)
468}
469
470/// Returns the whole number of work days between two dates.
471///
472/// [documentfoundation->NETWORKDAYS](https://wiki.documentfoundation.org/Documentation/Calc_Functions/NETWORKDAYS)
473///
474/// __Syntax__: 
475/// ```ods
476///     NETWORKDAYS( Date1: DateParam; Date2: DateParam; Holidays: DateSequence; Workdays: LogicalSequence )
477/// ```
478///
479/// __Constraints__:
480/// None
481///
482/// __Semantics__:
483/// Returns the whole number of work days between two dates.
484/// 
485/// Work days are defined as non-weekend, non-holiday days. By default, 
486/// weekends are Saturdays and Sundays and there are no holidays.
487/// 
488/// The optional 3rd parameter Holidays can be used to specify a list of dates 
489/// to be treated as holidays. Note that this parameter can be omitted as an 
490/// empty parameter (two consecutive ;; semicolons) to be able to pass the set 
491/// of Workdays without Holidays.
492/// 
493/// The optional 4th parameter Workdays can be used to specify a different 
494/// definition for the standard work week by passing in a list of numbers which 
495/// define which days of the week are workdays (indicated by 0) or not 
496/// (indicated by non-zero) in order Sunday, Monday,...,Saturday. So, the 
497/// default definition of the work week excludes Saturday and Sunday and is: 
498/// {1;0;0;0;0;0;1}. To define the work week as excluding Friday and Saturday, 
499/// the third parameter would be: {0;0;0;0;0;1;1}.
500///
501/// __See also__: [crate::of::networkdays()], [crate::of::networkdays_()], 
502#[inline]
503pub fn networkdays__<A: DateTime, B: DateTime, C: Sequence, D: Sequence>(date1: A, date2: B, holidays: C, workdays: D) -> FnNumber4<A, B, C, D> {
504    FnNumber4("NETWORKDAYS", date1, date2, holidays, workdays)
505}
506
507/// Returns the serial number of the current date and time.
508///
509/// [documentfoundation->NOW](https://wiki.documentfoundation.org/Documentation/Calc_Functions/NOW)
510///
511/// __Syntax__: 
512/// ```ods
513///     NOW( )
514/// ```
515///
516/// __Constraints__:
517/// None
518///
519/// __Semantics__:
520/// This returns the current day and time serial number, using the current 
521/// locale. If you want only the serial number of the current day, use TODAY 
522/// 6.10.19.
523///
524/// __See also__: [crate::of::date()], [crate::of::time()], [crate::of::today()], 
525#[inline]
526pub fn now() -> FnNumber0 {
527    FnNumber0("NOW", )
528}
529
530/// Extracts the second (the integer 0 through 59) from a time. This function 
531/// presumes that leap seconds never exist.
532///
533/// [documentfoundation->SECOND](https://wiki.documentfoundation.org/Documentation/Calc_Functions/SECOND)
534///
535/// __Syntax__: 
536/// ```ods
537///     SECOND( T: TimeParam )
538/// ```
539///
540/// __Constraints__:
541/// None
542///
543/// __Semantics__:
544/// Extract from T the second value, 0 through 59, as per a clock. Note that 
545/// this returns an integer, without a fractional part. Note also that this 
546/// rounds to the nearest second, instead of returning the integer part of the 
547/// seconds. This is equal to:
548/// 
549/// DayFraction = (T - INT(T))
550/// 
551/// HourFraction = (DayFraction * 24 - INT(DayFraction * 24))
552/// 
553/// MinuteFraction = (HourFraction * 60 - INT(HourFraction * 60))
554/// 
555/// Second = ROUND(MinuteFraction * 60)
556///
557/// __See also__: [crate::of::month()], [crate::of::day()], [crate::of::hour()], [crate::of::minute()], [crate::of::int()], 
558#[inline]
559pub fn second<A: DateTime>(t: A) -> FnNumber1<A> {
560    FnNumber1("SECOND", t)
561}
562
563/// Constructs a time value from hours, minutes, and seconds.
564///
565/// [documentfoundation->TIME](https://wiki.documentfoundation.org/Documentation/Calc_Functions/TIME)
566///
567/// __Syntax__: 
568/// ```ods
569///     TIME( Hours: Number; Minutes: Number; Seconds: Number )
570/// ```
571///
572/// __Constraints__:
573/// None. Evaluators may first perform INT() on the hour, minute, and second 
574/// before doing the calculation.
575///
576/// __Semantics__:
577/// Returns the fraction of the day consumed by the given time, i.e.:
578/// 
579/// ((Hours * 60 * 60) + (Minutes * 60) + Seconds) / (24 * 60 * 60)
580/// 
581/// Time is a subtype of Number, where a time value of 1 = 1 day = 24 hours.
582/// 
583/// Hours, Minutes, and Seconds may be any number (they shall not be limited to 
584/// the ranges 0..24, 0..59, or 0..60 respectively).
585///
586/// __See also__: [crate::of::date()], [crate::of::int()], 
587#[inline]
588pub fn time<A: Number, B: Number, C: Number>(hours: A, minutes: B, seconds: C) -> FnNumber3<A, B, C> {
589    FnNumber3("TIME", hours, minutes, seconds)
590}
591
592/// Returns a time serial number from given text.
593///
594/// [documentfoundation->TIMEVALUE](https://wiki.documentfoundation.org/Documentation/Calc_Functions/TIMEVALUE)
595///
596/// __Syntax__: 
597/// ```ods
598///     TIMEVALUE( T: Text )
599/// ```
600///
601/// __Constraints__:
602/// None
603///
604/// __Semantics__:
605/// This computes the serial number of the text string T, which is a time, 
606/// using the current locale. This function shall accept ISO time format 
607/// (HH:MM:SS), which is locale-independent. If the text of T has a combined 
608/// date and time format, e.g. YYYY-MM-DD HH:MM:SS, the fractional part of the 
609/// date serial number is returned. If the text of T does not have a time 
610/// format, an evaluator may attempt to convert the number another way (e.g., 
611/// using VALUE), or it may return an Error (this is implementation-dependent).
612///
613/// __See also__: [crate::of::time()], [crate::of::date()], [crate::of::datevalue()], [crate::of::value()], 
614#[inline]
615pub fn timevalue<A: Text>(t: A) -> FnNumber1<A> {
616    FnNumber1("TIMEVALUE", t)
617}
618
619/// Returns the serial number of today.
620///
621/// [documentfoundation->TODAY](https://wiki.documentfoundation.org/Documentation/Calc_Functions/TODAY)
622///
623/// __Syntax__: 
624/// ```ods
625///     TODAY( )
626/// ```
627///
628/// __Constraints__:
629/// None
630///
631/// __Semantics__:
632/// This returns the current day's serial number, using current locale. This 
633/// only returns the date, not the datetime value. For the specific time of day 
634/// as well, use NOW 6.10.15.
635///
636/// __See also__: [crate::of::time()], [crate::of::now()], 
637#[inline]
638pub fn today() -> FnNumber0 {
639    FnNumber0("TODAY", )
640}
641
642/// Extracts the day of the week from a date; if text, uses current locale to 
643/// convert to a date.
644///
645/// [documentfoundation->WEEKDAY](https://wiki.documentfoundation.org/Documentation/Calc_Functions/WEEKDAY)
646///
647/// __Syntax__: 
648/// ```ods
649///     WEEKDAY( D: DateParam )
650/// ```
651///
652/// __Constraints__:
653/// None
654///
655/// __Semantics__:
656/// Returns the day of the week from a date D, as a number from 0 through 7. 
657/// The exact meaning depends on the value of Type:
658/// 
659/// 1.When Type is 1, Sunday is the first day of the week, with value 1; 
660/// Saturday has value 7.
661/// 
662/// 2.When Type is 2, Monday is the first day of the week, with value 1; Sunday 
663/// has value 7.
664/// 
665/// 3.When Type is 3, Monday is the first day of the week, with value 0; Sunday 
666/// has value 6.
667/// 
668/// 4.When Type is 11, Monday is the first day of the week, with value 1; 
669/// Sunday has value 7.
670/// 
671/// 5.When Type is 12, Tuesday is the first day of the week, with value 1; 
672/// Monday has value 7.
673/// 
674/// 6.When Type is 13, Wednesday is the first day of the week, with value 1; 
675/// Tuesday has value 7.
676/// 
677/// 7.When Type is 14, Thursday is the first day of the week, with value 1; 
678/// Wednesday has value 7.
679/// 
680/// 8.When Type is 15, Friday is the first day of the week, with value 1; 
681/// Thursday has value 7.
682/// 
683/// 9.When Type is 16, Saturday is the first day of the week, with value 1; 
684/// Friday has value 7.
685/// 
686/// 10. When Type is 17, Sunday is the first day of the week, with value 1; 
687/// Saturday has value 7.
688///
689/// __See also__: [crate::of::day()], [crate::of::month()], [crate::of::year()], [crate::of::weekday_()], 
690#[inline]
691pub fn weekday<A: DateTime>(d: A) -> FnNumber1<A> {
692    FnNumber1("WEEKDAY", d)
693}
694
695/// Extracts the day of the week from a date; if text, uses current locale to 
696/// convert to a date.
697///
698/// [documentfoundation->WEEKDAY](https://wiki.documentfoundation.org/Documentation/Calc_Functions/WEEKDAY)
699///
700/// __Syntax__: 
701/// ```ods
702///     WEEKDAY( D: DateParam; Type: Integer )
703/// ```
704///
705/// __Constraints__:
706/// None
707///
708/// __Semantics__:
709/// Returns the day of the week from a date D, as a number from 0 through 7. 
710/// The exact meaning depends on the value of Type:
711/// 
712/// 1.When Type is 1, Sunday is the first day of the week, with value 1; 
713/// Saturday has value 7.
714/// 
715/// 2.When Type is 2, Monday is the first day of the week, with value 1; Sunday 
716/// has value 7.
717/// 
718/// 3.When Type is 3, Monday is the first day of the week, with value 0; Sunday 
719/// has value 6.
720/// 
721/// 4.When Type is 11, Monday is the first day of the week, with value 1; 
722/// Sunday has value 7.
723/// 
724/// 5.When Type is 12, Tuesday is the first day of the week, with value 1; 
725/// Monday has value 7.
726/// 
727/// 6.When Type is 13, Wednesday is the first day of the week, with value 1; 
728/// Tuesday has value 7.
729/// 
730/// 7.When Type is 14, Thursday is the first day of the week, with value 1; 
731/// Wednesday has value 7.
732/// 
733/// 8.When Type is 15, Friday is the first day of the week, with value 1; 
734/// Thursday has value 7.
735/// 
736/// 9.When Type is 16, Saturday is the first day of the week, with value 1; 
737/// Friday has value 7.
738/// 
739/// 10. When Type is 17, Sunday is the first day of the week, with value 1; 
740/// Saturday has value 7.
741///
742/// __See also__: [crate::of::day()], [crate::of::month()], [crate::of::year()], [crate::of::weekday()], 
743#[inline]
744pub fn weekday_<A: DateTime>(d: A, type_: WeekdayMethod) -> FnNumber2<A, WeekdayMethod> {
745    FnNumber2("WEEKDAY", d, type_)
746}
747
748/// Determines the week number of the year for a given date.
749///
750/// [documentfoundation->WEEKNUM](https://wiki.documentfoundation.org/Documentation/Calc_Functions/WEEKNUM)
751///
752/// __Syntax__: 
753/// ```ods
754///     WEEKNUM( D: DateParam )
755/// ```
756///
757/// __Constraints__:
758/// 1 ≤ Mode ≤ 2, or 11 ≤ Mode ≤ 17, or Mode = 21, or Mode = 150
759///
760/// __Semantics__:
761/// Returns the number of the week in the year for the given date.
762/// 
763/// For Mode = {1, 2, 11, 12, ..., 17} the week containing January 1 is the 
764/// first week of the year, and is numbered week 1. The week starts on {Sunday, 
765/// Monday, Monday, Tuesday, ..., Sunday}.
766/// 
767/// Mode 21 and Mode 150 are both ISO8601, the week starts on Monday and the 
768/// week containing the first Thursday of the year is the first week of the 
769/// year, and is numbered week 1.
770///
771/// __See also__: [crate::of::day()], [crate::of::month()], [crate::of::year()], [crate::of::weekday()], [crate::of::isoweeknum()], [crate::of::weeknum_()], 
772#[inline]
773pub fn weeknum<A: DateTime>(d: A) -> FnNumber1<A> {
774    FnNumber1("WEEKNUM", d)
775}
776
777/// Determines the week number of the year for a given date.
778///
779/// [documentfoundation->WEEKNUM](https://wiki.documentfoundation.org/Documentation/Calc_Functions/WEEKNUM)
780///
781/// __Syntax__: 
782/// ```ods
783///     WEEKNUM( D: DateParam; Mode: Number )
784/// ```
785///
786/// __Constraints__:
787/// 1 ≤ Mode ≤ 2, or 11 ≤ Mode ≤ 17, or Mode = 21, or Mode = 150
788///
789/// __Semantics__:
790/// Returns the number of the week in the year for the given date.
791/// 
792/// For Mode = {1, 2, 11, 12, ..., 17} the week containing January 1 is the 
793/// first week of the year, and is numbered week 1. The week starts on {Sunday, 
794/// Monday, Monday, Tuesday, ..., Sunday}.
795/// 
796/// Mode 21 and Mode 150 are both ISO8601, the week starts on Monday and the 
797/// week containing the first Thursday of the year is the first week of the 
798/// year, and is numbered week 1.
799///
800/// __See also__: [crate::of::day()], [crate::of::month()], [crate::of::year()], [crate::of::weekday()], [crate::of::isoweeknum()], [crate::of::weeknum()], 
801#[inline]
802pub fn weeknum_<A: DateTime>(d: A, mode: WeeknumMethod) -> FnNumber2<A, WeeknumMethod> {
803    FnNumber2("WEEKNUM", d, mode)
804}
805
806/// Returns the date serial number which is a specified number of work days 
807/// before or after an input date.
808///
809/// [documentfoundation->WORKDAY](https://wiki.documentfoundation.org/Documentation/Calc_Functions/WORKDAY)
810///
811/// __Syntax__: 
812/// ```ods
813///     WORKDAY( Date: DateParam; Offset: Number )
814/// ```
815///
816/// __Constraints__:
817/// None
818///
819/// __Semantics__:
820/// Returns the date serial number for the day that is offset from the input 
821/// Date parameter by the number of work days specified in the Offset 
822/// parameter. If Offset is negative, the offset will return a date prior to 
823/// Date. If Offset is positive, a date later Date is returned. If Offset is 
824/// zero, then Date is returned.
825/// 
826/// Work days are defined as non-weekend, non-holiday days. By default, 
827/// weekends are Saturdays and Sundays and there are no holidays.
828/// 
829/// The optional 3rd parameter Holidays can be used to specify a list of dates 
830/// to be treated as holidays. Note that this parameter can be omitted as an 
831/// empty parameter (two consecutive ;; semicolons) to be able to pass the set 
832/// of Workdays without Holidays.
833/// 
834/// The optional 4th parameter Workdays can be used to specify a different 
835/// definition for the standard work week by passing in a list of numbers which 
836/// define which days of the week are workdays (indicated by 0) or not 
837/// (indicated by non-zero) in order Sunday, Monday,...,Saturday. If all seven 
838/// numbers in Workdays are non-zero and Offset is also non-zero, WORKDAY 
839/// returns an error.
840///
841/// __Note__:
842/// The default definition of the work week that excludes Saturday and Sunday 
843/// and is: {1;0;0;0;0;0;1}. To define the workweek as excluding Friday and 
844/// Saturday, the third parameter would be: {0;0;0;0;0;1;1}.
845///
846/// __See also__: [crate::of::workday_()], [crate::of::workday__()], 
847#[inline]
848pub fn workday<A: DateTime, B: Number>(date: A, offset: B) -> FnNumber2<A, B> {
849    FnNumber2("WORKDAY", date, offset)
850}
851
852/// Returns the date serial number which is a specified number of work days 
853/// before or after an input date.
854///
855/// [documentfoundation->WORKDAY](https://wiki.documentfoundation.org/Documentation/Calc_Functions/WORKDAY)
856///
857/// __Syntax__: 
858/// ```ods
859///     WORKDAY( Date: DateParam; Offset: Number; Holidays: DateSequence )
860/// ```
861///
862/// __Constraints__:
863/// None
864///
865/// __Semantics__:
866/// Returns the date serial number for the day that is offset from the input 
867/// Date parameter by the number of work days specified in the Offset 
868/// parameter. If Offset is negative, the offset will return a date prior to 
869/// Date. If Offset is positive, a date later Date is returned. If Offset is 
870/// zero, then Date is returned.
871/// 
872/// Work days are defined as non-weekend, non-holiday days. By default, 
873/// weekends are Saturdays and Sundays and there are no holidays.
874/// 
875/// The optional 3rd parameter Holidays can be used to specify a list of dates 
876/// to be treated as holidays. Note that this parameter can be omitted as an 
877/// empty parameter (two consecutive ;; semicolons) to be able to pass the set 
878/// of Workdays without Holidays.
879/// 
880/// The optional 4th parameter Workdays can be used to specify a different 
881/// definition for the standard work week by passing in a list of numbers which 
882/// define which days of the week are workdays (indicated by 0) or not 
883/// (indicated by non-zero) in order Sunday, Monday,...,Saturday. If all seven 
884/// numbers in Workdays are non-zero and Offset is also non-zero, WORKDAY 
885/// returns an error.
886///
887/// __Note__:
888/// The default definition of the work week that excludes Saturday and Sunday 
889/// and is: {1;0;0;0;0;0;1}. To define the workweek as excluding Friday and 
890/// Saturday, the third parameter would be: {0;0;0;0;0;1;1}.
891///
892/// __See also__: [crate::of::workday()], [crate::of::workday__()], 
893#[inline]
894pub fn workday_<A: DateTime, B: Number, C: Sequence>(date: A, offset: B, holidays: C) -> FnNumber3<A, B, C> {
895    FnNumber3("WORKDAY", date, offset, holidays)
896}
897
898/// Returns the date serial number which is a specified number of work days 
899/// before or after an input date.
900///
901/// [documentfoundation->WORKDAY](https://wiki.documentfoundation.org/Documentation/Calc_Functions/WORKDAY)
902///
903/// __Syntax__: 
904/// ```ods
905///     WORKDAY( Date: DateParam; Offset: Number; Holidays: DateSequence; Workdays: LogicalSequence )
906/// ```
907///
908/// __Constraints__:
909/// None
910///
911/// __Semantics__:
912/// Returns the date serial number for the day that is offset from the input 
913/// Date parameter by the number of work days specified in the Offset 
914/// parameter. If Offset is negative, the offset will return a date prior to 
915/// Date. If Offset is positive, a date later Date is returned. If Offset is 
916/// zero, then Date is returned.
917/// 
918/// Work days are defined as non-weekend, non-holiday days. By default, 
919/// weekends are Saturdays and Sundays and there are no holidays.
920/// 
921/// The optional 3rd parameter Holidays can be used to specify a list of dates 
922/// to be treated as holidays. Note that this parameter can be omitted as an 
923/// empty parameter (two consecutive ;; semicolons) to be able to pass the set 
924/// of Workdays without Holidays.
925/// 
926/// The optional 4th parameter Workdays can be used to specify a different 
927/// definition for the standard work week by passing in a list of numbers which 
928/// define which days of the week are workdays (indicated by 0) or not 
929/// (indicated by non-zero) in order Sunday, Monday,...,Saturday. If all seven 
930/// numbers in Workdays are non-zero and Offset is also non-zero, WORKDAY 
931/// returns an error.
932///
933/// __Note__:
934/// The default definition of the work week that excludes Saturday and Sunday 
935/// and is: {1;0;0;0;0;0;1}. To define the workweek as excluding Friday and 
936/// Saturday, the third parameter would be: {0;0;0;0;0;1;1}.
937///
938/// __See also__: [crate::of::workday()], [crate::of::workday_()], 
939#[inline]
940pub fn workday__<A: DateTime, B: Number, C: Sequence, D: Sequence>(date: A, offset: B, holidays: C, workdays: D) -> FnNumber4<A, B, C, D> {
941    FnNumber4("WORKDAY", date, offset, holidays, workdays)
942}
943
944/// Extracts the year from a date given in the current locale of the evaluator.
945///
946/// [documentfoundation->YEAR](https://wiki.documentfoundation.org/Documentation/Calc_Functions/YEAR)
947///
948/// __Syntax__: 
949/// ```ods
950///     YEAR( D: DateParam )
951/// ```
952///
953/// __Constraints__:
954/// None
955///
956/// __Semantics__:
957/// Parses a date-formatted string in the current locale's format and returns 
958/// the year portion.
959/// 
960/// If a year is given as a two-digit number, as in "05-21-15", then the year 
961/// returned is either 1915 or 2015, depending upon the break point in the 
962/// calculation context. In an OpenDocument document, this break point is 
963/// determined by HOST-NULL-YEAR.
964/// 
965/// Evaluators shall support extracting the year from a date beginning in 1900. 
966/// Three-digit year numbers precede adoption of the Gregorian calendar, and 
967/// may return either an Error or the year number. Four-digit year numbers 
968/// preceding 1582 (inception of the Gregorian Calendar) may return either an 
969/// Error or the year number. Four-digit year numbers following 1582 should 
970/// return the year number.
971///
972/// __See also__: [crate::of::month()], [crate::of::day()], [crate::of::value()], 
973#[inline]
974pub fn year<A: DateTime>(d: A) -> FnNumber1<A> {
975    FnNumber1("YEAR", d)
976}
977
978/// Extracts the number of years (including fractional part) between two dates
979///
980/// [documentfoundation->YEARFRAC](https://wiki.documentfoundation.org/Documentation/Calc_Functions/YEARFRAC)
981///
982/// __Syntax__: 
983/// ```ods
984///     YEARFRAC( StartDate: DateParam; EndDate: DateParam )
985/// ```
986///
987/// __Constraints__:
988/// None
989///
990/// __Semantics__:
991/// Computes the fraction of the number of years between a StartDate and 
992/// EndDate.
993/// 
994/// B indicates the day-count convention to use in the calculation. 4.11.7
995///
996/// __See also__: [crate::of::datedif()], [crate::of::yearfrac_()], 
997#[inline]
998pub fn yearfrac<A: DateTime, B: DateTime>(start_date: A, end_date: B) -> FnNumber2<A, B> {
999    FnNumber2("YEARFRAC", start_date, end_date)
1000}
1001
1002/// Extracts the number of years (including fractional part) between two dates
1003///
1004/// [documentfoundation->YEARFRAC](https://wiki.documentfoundation.org/Documentation/Calc_Functions/YEARFRAC)
1005///
1006/// __Syntax__: 
1007/// ```ods
1008///     YEARFRAC( StartDate: DateParam; EndDate: DateParam; B: Basis )
1009/// ```
1010///
1011/// __Constraints__:
1012/// None
1013///
1014/// __Semantics__:
1015/// Computes the fraction of the number of years between a StartDate and 
1016/// EndDate.
1017/// 
1018/// B indicates the day-count convention to use in the calculation. 4.11.7
1019///
1020/// __See also__: [crate::of::datedif()], [crate::of::yearfrac()], 
1021#[inline]
1022pub fn yearfrac_<A: DateTime, B: DateTime>(start_date: A, end_date: B, b: YearFracMethod) -> FnNumber3<A, B, YearFracMethod> {
1023    FnNumber3("YEARFRAC", start_date, end_date, b)
1024}