0

I have a table:

CREATE TABLE "date" (
    "datetime" TEXT,
    PRIMARY KEY("datetime")
);

and rows:

datetime
--------
2019-02-01 01:30+03:00
2019-02-01 02:30:10-03:00
...

For example, my timezone is +01:00

How can I select date and time without timezone?

SELECT 
   ??? as "date", 
   ??? as "time", 
   ??? as "timezone", 
   datetime("datetime", "+01:00") as "local"
FROM "date";
date       | time     | timezone | local
-----------|----------|----------|--------------------
2019-02-01 | 01:30:00 | +03:00   | 2019-01-31 23:30:00
2019-02-01 | 02:30:10 | -03:00   | 2019-02-01 06:30:10
  • See the documentation. For the time zone, you need string functions. – CL. Feb 20 at 8:33
  • You have some problem in your data here "30+03:00". Since your data is in TEXT, time zone won't apply to stored data. – NoChance Oct 11 at 22:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.