Skip to content

Commit 3cc8807

Browse files
authored
ESQL - add some CSV tests for current timezone behavior (#127181) (#127233)
I just needed to check the current behavior around this, and figured I'd add the queries I used as CSV tests for future reference.
1 parent 42a6952 commit 3cc8807

File tree

1 file changed

+24
-0
lines changed
  • x-pack/plugin/esql/qa/testFixtures/src/main/resources

1 file changed

+24
-0
lines changed

x-pack/plugin/esql/qa/testFixtures/src/main/resources/date.csv-spec

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,30 @@ birth_date:date |bd:date
200200
1964-06-02T00:00:00.000Z|1964-06-02T00:00:00.000Z
201201
;
202202

203+
convert with zones
204+
ROW str = "2025-04-11T05:00:00+0400"
205+
| EVAL dt = TO_DATETIME(str);
206+
207+
str:String | dt:datetime
208+
"2025-04-11T05:00:00+0400" | 2025-04-11T01:00:00.000Z
209+
;
210+
211+
equality with zones
212+
ROW dt = TO_DATETIME("2025-04-11T01:00:00.000Z")
213+
| EVAL bool = "2025-04-11T05:00:00+0400" == dt;
214+
215+
dt:datetime | bool:boolean
216+
2025-04-11T01:00:00.000Z | true
217+
;
218+
219+
convert no zone
220+
ROW str = "2025-04-11T05:00:00.000"
221+
| EVAL dt = TO_DATETIME(str);
222+
223+
str:String | dt:datetime
224+
"2025-04-11T05:00:00.000" | 2025-04-11T05:00:00.000Z
225+
;
226+
203227
convertFromString#[skip:-8.13.99, reason: default date formatter is changed in 8.14]
204228
// tag::to_datetime-str[]
205229
ROW string = ["1953-09-02T00:00:00.000Z", "1964-06-02T00:00:00.000Z", "1964-06-02 00:00:00"]

0 commit comments

Comments
 (0)