I understand when I ingest data into QuestDB, the timestamps are always stored as UTC. This is all good, I get it, but I would like to see the timestamps in my local time zone. I live in Central Europe, my clock says right now it is 20:02, but if I do this
select now();
I am getting:
2024-08-13T18:02:45.878063Z
As you see, I am two hours ahead of UTC. I thought I could convert this just doing
select to_utc(now(), 'CEST');
but it gets even worse, as now it says
2024-08-13T16:02:45.878063Z
I could always leave the UTC, but this being a time-series database I am sure it can be done.
I had it backwards. The to_utc
function is to convert from local time to UTC, so it was substracting two hours!!! What I need instead is the to_timezone
function. Note what happens when I run this query at 20:05 my local time:
select now(), to_timezone(now(), 'CEST'), to_utc(now(), 'CEST');
now to_timezone to_utc
=========================== =========================== ===========================
2024-08-13T18:05:18.246232Z 2024-08-13T20:05:18.246232Z 2024-08-13T16:05:18.246232Z