You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Databend automatically converts invalid Date or Timestamp values to their minimum valid equivalents, `1000-01-01` for dates and `1000-01-01 00:00:00` for timestamps, ensuring consistency when working with out-of-range or incorrectly formatted dates and timestamps.
204
+
205
+
Examples:
206
+
207
+
```sql
208
+
-- Attempts to add one day to the maximum date, exceeding the valid range.
209
+
-- Result: Returns DateMIN (1000-01-01) instead of an error.
210
+
SELECT ADD_DAYS(TO_DATE('9999-12-31'), 1);
211
+
212
+
┌────────────────────────────────────┐
213
+
│ add_days(to_date('9999-12-31'), 1) │
214
+
├────────────────────────────────────┤
215
+
│ 1000-01-01 │
216
+
└────────────────────────────────────┘
217
+
```
218
+
219
+
```sql
220
+
-- Attempts to subtract one minute from the minimum date, which would be invalid.
221
+
-- Result: Returns DateMIN (1000-01-01 00:00:00), ensuring stability in results.
In Databend, certain date and time functions like [TO_DATE](../../20-sql-functions/05-datetime-functions/to-date.md) and [TO_TIMESTAMP](../../20-sql-functions/05-datetime-functions/to-timestamp.md) require you to specify the desired format for date and time values. To handle date and time formatting, Databend makes use of the chrono::format::strftime module, which is a standard module provided by the chrono library in Rust. This module enables precise control over the formatting of dates and times. The following content is excerpted from [https://docs.rs/chrono/latest/chrono/format/strftime/index.html](https://docs.rs/chrono/latest/chrono/format/strftime/index.html):
0 commit comments