From 88bdcba6faf9bbcaa4c31acffb038a44b7b93de1 Mon Sep 17 00:00:00 2001 From: Mark Tozzi Date: Wed, 23 Apr 2025 07:29:13 -0400 Subject: [PATCH] ESQL - add some CSV tests for current timezone behavior (#127181) 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. --- .../src/main/resources/date.csv-spec | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/x-pack/plugin/esql/qa/testFixtures/src/main/resources/date.csv-spec b/x-pack/plugin/esql/qa/testFixtures/src/main/resources/date.csv-spec index ee51a9bd3adc1..72185f73f6a36 100644 --- a/x-pack/plugin/esql/qa/testFixtures/src/main/resources/date.csv-spec +++ b/x-pack/plugin/esql/qa/testFixtures/src/main/resources/date.csv-spec @@ -200,6 +200,30 @@ birth_date:date |bd:date 1964-06-02T00:00:00.000Z|1964-06-02T00:00:00.000Z ; +convert with zones +ROW str = "2025-04-11T05:00:00+0400" +| EVAL dt = TO_DATETIME(str); + +str:String | dt:datetime +"2025-04-11T05:00:00+0400" | 2025-04-11T01:00:00.000Z +; + +equality with zones +ROW dt = TO_DATETIME("2025-04-11T01:00:00.000Z") +| EVAL bool = "2025-04-11T05:00:00+0400" == dt; + +dt:datetime | bool:boolean +2025-04-11T01:00:00.000Z | true +; + +convert no zone +ROW str = "2025-04-11T05:00:00.000" +| EVAL dt = TO_DATETIME(str); + +str:String | dt:datetime +"2025-04-11T05:00:00.000" | 2025-04-11T05:00:00.000Z +; + convertFromString#[skip:-8.13.99, reason: default date formatter is changed in 8.14] // tag::to_datetime-str[] ROW string = ["1953-09-02T00:00:00.000Z", "1964-06-02T00:00:00.000Z", "1964-06-02 00:00:00"]