Search code examples
google-sheetsgoogle-sheets-formulagoogle-sheets-apispreadsheet

How can I format a string sheet to date with Query 2


I need change

Column A Column B
1 2022-11-17T13:41:47.431Z
3 2022-11-10T21:42:06-03:00
3 2022-11-10 22:01:00

To this with the query on sheets!

Column A Column B
1 2022-11-17 13:41:47
3 2022-11-10 21:42:06
3 2022-11-10 22:01:00

I tried! Follow the link https://docs.google.com/spreadsheets/d/1X0fbTuorNeIWbusgZ4fWdjzRwxhxUld_iCxqhzJ5uZM/edit#gid=181823931


Solution

  • Maybe this works for you?

        = ARRAYFORMULA(
    query({A1:A,
        IF(B1:B <> "",
            REGEXEXTRACT(TO_TEXT(B1:B), "\d+-\d+-\d+") 
            &" "&
            REGEXEXTRACT(TO_TEXT(B1:B), "\d+:\d+:\d+"),
        )}
           ))