|
19 | 19 | import java.util.function.Function;
|
20 | 20 |
|
21 | 21 | /**
|
22 |
| - * Expresses a date value. |
| 22 | + * An instantaneous date and time. Tracks a UTC datetime, the number of |
| 23 | + * milliseconds since the Unix epoch. Does not track the timezone. |
23 | 24 | */
|
24 | 25 | public interface DateExpression extends Expression {
|
| 26 | + |
| 27 | + /** |
| 28 | + * The year of {@code this} date as determined by the provided |
| 29 | + * {@code timezone}. |
| 30 | + * |
| 31 | + * @param timezone the UTC Offset or Olson Timezone Identifier. |
| 32 | + * @return the resulting value. |
| 33 | + */ |
25 | 34 | IntegerExpression year(StringExpression timezone);
|
| 35 | + |
| 36 | + /** |
| 37 | + * The month of {@code this} date as determined by the provided |
| 38 | + * {@code timezone}, as an integer between 1 and 12. |
| 39 | + * |
| 40 | + * @param timezone the UTC Offset or Olson Timezone Identifier. |
| 41 | + * @return the resulting value. |
| 42 | + */ |
26 | 43 | IntegerExpression month(StringExpression timezone);
|
| 44 | + |
| 45 | + /** |
| 46 | + * The day of the month of {@code this} date as determined by the provided |
| 47 | + * {@code timezone}, as an integer between 1 and 31. |
| 48 | + * |
| 49 | + * @param timezone the UTC Offset or Olson Timezone Identifier. |
| 50 | + * @return the resulting value. |
| 51 | + */ |
27 | 52 | IntegerExpression dayOfMonth(StringExpression timezone);
|
| 53 | + |
| 54 | + /** |
| 55 | + * The day of the week of {@code this} date as determined by the provided |
| 56 | + * {@code timezone}, as an integer between 1 (Sunday) and 7 (Saturday). |
| 57 | + * |
| 58 | + * @param timezone the UTC Offset or Olson Timezone Identifier. |
| 59 | + * @return the resulting value. |
| 60 | + */ |
28 | 61 | IntegerExpression dayOfWeek(StringExpression timezone);
|
| 62 | + |
| 63 | + /** |
| 64 | + * The day of the year of {@code this} date as determined by the provided |
| 65 | + * {@code timezone}, as an integer between 1 and 366. |
| 66 | + * |
| 67 | + * @param timezone the UTC Offset or Olson Timezone Identifier. |
| 68 | + * @return the resulting value. |
| 69 | + */ |
29 | 70 | IntegerExpression dayOfYear(StringExpression timezone);
|
| 71 | + |
| 72 | + /** |
| 73 | + * The hour of {@code this} date as determined by the provided |
| 74 | + * {@code timezone}, as an integer between 0 and 23. |
| 75 | + * |
| 76 | + * @param timezone the UTC Offset or Olson Timezone Identifier. |
| 77 | + * @return the resulting value. |
| 78 | + */ |
30 | 79 | IntegerExpression hour(StringExpression timezone);
|
| 80 | + |
| 81 | + /** |
| 82 | + * The minute of {@code this} date as determined by the provided |
| 83 | + * {@code timezone}, as an integer between 0 and 59. |
| 84 | + * |
| 85 | + * @param timezone the UTC Offset or Olson Timezone Identifier. |
| 86 | + * @return the resulting value. |
| 87 | + */ |
31 | 88 | IntegerExpression minute(StringExpression timezone);
|
| 89 | + |
| 90 | + /** |
| 91 | + * The second of {@code this} date as determined by the provided |
| 92 | + * {@code timezone}, as an integer between 0 and 59, and 60 in the case |
| 93 | + * of a leap second. |
| 94 | + * |
| 95 | + * @param timezone the UTC Offset or Olson Timezone Identifier. |
| 96 | + * @return the resulting value. |
| 97 | + */ |
32 | 98 | IntegerExpression second(StringExpression timezone);
|
| 99 | + |
| 100 | + /** |
| 101 | + * The week of the year of {@code this} date as determined by the provided |
| 102 | + * {@code timezone}, as an integer between 0 and 53. |
| 103 | + * |
| 104 | + * <p>Weeks begin on Sundays, and week 1 begins with the first Sunday of the |
| 105 | + * year. Days preceding the first Sunday of the year are in week 0. |
| 106 | + * |
| 107 | + * @param timezone the UTC Offset or Olson Timezone Identifier. |
| 108 | + * @return the resulting value. |
| 109 | + */ |
33 | 110 | IntegerExpression week(StringExpression timezone);
|
| 111 | + |
| 112 | + /** |
| 113 | + * The millisecond part of {@code this} date as determined by the provided |
| 114 | + * {@code timezone}, as an integer between 0 and 999. |
| 115 | + * |
| 116 | + * @param timezone the UTC Offset or Olson Timezone Identifier. |
| 117 | + * @return the resulting value. |
| 118 | + */ |
34 | 119 | IntegerExpression millisecond(StringExpression timezone);
|
35 | 120 |
|
| 121 | + /** |
| 122 | + * The string representation of {@code this} date as determined by the |
| 123 | + * provided {@code timezone}, and formatted according to the {@code format}. |
| 124 | + * |
| 125 | + * @param timezone the UTC Offset or Olson Timezone Identifier. |
| 126 | + * @param format the format specifier. TODO-END what standard is this? |
| 127 | + * @return the resulting value. |
| 128 | + */ |
36 | 129 | StringExpression asString(StringExpression timezone, StringExpression format);
|
37 | 130 |
|
38 | 131 | <R extends Expression> R passDateTo(Function<? super DateExpression, ? extends R> f);
|
|
0 commit comments