I have a table with column that contains timezone in format: +00:00 eg.:
tz |
---|
+04:30 |
+02:00 |
+10:00 |
-04:00 |
I can use CAST in MySQL: CAST(tz AS SIGNED)
and it will give this result:
CAST(tz AS SIGNED) |
---|
4 |
2 |
10 |
-4 |
I tried to use toInt64
for ClickHouse, but it produce an exception.
How I can reach the same result with ClickHouse ?
SELECT
arrayJoin(['+04:30', '-4:30', '10:00']) AS x,
toInt64OrZero(extract(x, '(.*):')) AS y
Query id: 4b704281-649a-499e-906c-89873112c9e1
┌─x──────┬──y─┐
│ +04:30 │ 4 │
│ -4:30 │ -4 │
│ 10:00 │ 10 │
└────────┴────┘