@@ -82,142 +82,7 @@ public class TimeUtils {
8282
8383 /**
8484 * Returns the relative {@link ZonedDateTime} corresponding to the given relative string and zoned date time.
85- * <p>
86- * The relative time string has syntax {@code [+|-]<offset_time_integer><offset_time_unit>@<snap_time_unit>}, and
87- * is made up of two optional components:
88- * <ul>
89- * <li>
90- * An offset from the current timestamp at the start of query execution, which is composed of a sign
91- * ({@code +} or {@code -}), an optional time integer, and a time unit. If the time integer is not specified,
92- * it defaults to one. For example, {@code +2hr} corresponds to two hours after the current timestamp, while
93- * {@code -mon} corresponds to one month ago.
94- * </li>
95- * <li>
96- * A snap-to time using the {@code @} symbol followed by a time unit. The snap-to time is applied after the
97- * offset (if specified), and rounds the time <i>down</i> to the start of the specified time unit (i.e.
98- * backwards in time). For example, {@code @wk} corresponds to the start of the current week (Sunday is
99- * considered to be the first day of the week).
100- * </li>
101- * </ul>
102- * <p>
103- * The following offset time units are supported:
104- * <table border="1">
105- * <body>
106- * <tr>
107- * <th>Time Unit</th>
108- * <th>Supported Keywords</th>
109- * </tr>
110- * <tr>
111- * <td>Seconds</td>
112- * <td>{@code s}, {@code sec}, {@code secs}, {@code second}, {@code seconds}</td>
113- * </tr>
114- * <tr>
115- * <td>Minutes</td>
116- * <td>{@code m}, {@code min}, {@code mins}, {@code minute}, {@code minutes}</td>
117- * </tr>
118- * <tr>
119- * <td>Hours</td>
120- * <td>{@code h}, {@code hr}, {@code hrs}, {@code hour}, {@code hours}</td>
121- * </tr>
122- * <tr>
123- * <td>Days</td>
124- * <td>{@code d}, {@code day}, {@code days}</td>
125- * </tr>
126- * <tr>
127- * <td>Weeks</td>
128- * <td>{@code w}, {@code wk}, {@code wks}, {@code week}, {@code weeks}</td>
129- * </tr>
130- * <tr>
131- * <td>Quarters</td>
132- * <td>{@code q}, {@code qtr}, {@code qtrs}, {@code quarter}, {@code quarters}</td>
133- * </tr>
134- * <tr>
135- * <td>Years</td>
136- * <td>{@code y}, {@code yr}, {@code yrs}, {@code year}, {@code years}</td>
137- * </tr>
138- * </body>
139- * </table>
140- * <p>
141- * The snap-to time supports all the time units above, as well as the following day of the week time units:
142- * <table border="1">
143- * <body>
144- * <tr>
145- * <th>Time Unit</th>
146- * <th>Supported Keywords</th>
147- * </tr>
148- * <tr>
149- * <td>Sunday</td>
150- * <td>{@code w0}, {@code w7}</td>
151- * </tr>
152- * <tr>
153- * <td>Monday</td>
154- * <td>{@code w1}</td>
155- * </tr>
156- * <tr>
157- * <td>Tuesday</td>
158- * <td>{@code w2}</td>
159- * </tr>
160- * <tr>
161- * <td>Wednesday</td>
162- * <td>{@code w3}</td>
163- * </tr>
164- * <tr>
165- * <td>Thursday</td>
166- * <td>{@code w4}</td>
167- * </tr>
168- * <tr>
169- * <td>Friday</td>
170- * <td>{@code w5}</td>
171- * </tr>
172- * <tr>
173- * <td>Saturday</td>
174- * <td>{@code w6}</td>
175- * </tr>
176- * </body>
177- * </table>
178- * <p>
179- * The special relative time string {@code now} for the current timestamp is also supported.
180- * <p>
181- * For example, if the current timestamp is Monday, January 03, 2000 at 01:01:01 am:
182- * <table border="1">
183- * <body>
184- * <tr>
185- * <th>Relative String</th>
186- * <th>Description</th>
187- * <th>Resulting Relative Time</th>
188- * </tr>
189- * <tr>
190- * <td>{@code -60m}</td>
191- * <td>Sixty minutes ago</td>
192- * <td>Monday, January 03, 2000 at 00:01:01 am</td>
193- * </tr>
194- * <tr>
195- * <td>{@code -h}</td>
196- * <td>One hour ago</td>
197- * <td>Monday, January 03, 2000 at 00:01:01 am</td>
198- * </tr>
199- * <tr>
200- * <td>{@code +2wk}</td>
201- * <td>Two weeks from now</td>
202- * <td>Monday, January 17, 2000 at 00:01:01 am</td>
203- * </tr>
204- * <tr>
205- * <td>{@code -1h@w3}</td>
206- * <td>One hour ago, rounded to the start of the previous Wednesday</td>
207- * <td>Wednesday, December 29, 1999 at 00:00:00 am</td>
208- * </tr>
209- * <tr>
210- * <td>{@code @d}</td>
211- * <td>Start of the current day</td>
212- * <td>Monday, January 03, 2000 at 00:00:00 am</td>
213- * </tr>
214- * <tr>
215- * <td>{@code now}</td>
216- * <td>Now</td>
217- * <td>Monday, January 03, 2000 at 01:01:01 am</td>
218- * </tr>
219- * </body>
220- * </table>
85+ * @see <a href="docs/ppl-lang/functions/ppl-datetime#relative_timestamp">RELATIVE_TIMESTAMP</a> for more details.
22186 */
22287 public static ZonedDateTime getRelativeZonedDateTime (String relativeString , ZonedDateTime zonedDateTime ) {
22388
0 commit comments