I want to cast the current_timestamp in Big Query to a string but it add 00
which stand for UTC as the time zone to the string. I only want the timestamp without the zone i.e. without 00
. How can I get that?
This is what I'm doing:
select STRING(CURRENT_TIMESTAMP()) as now
The result:
2022-11-29 10:56:12.793309 00
I want:
2022-11-29 10:56:12.793309
CodePudding user response:
Consider more formal way below.
SELECT FORMAT_TIMESTAMP('%F %T.%E*S', CURRENT_TIMESTAMP()) as now
%F
- The date in the format %Y-%m-%d.%T
- The time in the format %H:%M:%S.%E*S
- Seconds with full fractional precision (a literal '*').
CodePudding user response:
I thought of a hacky solution:
split(STRING(CURRENT_TIMESTAMP()), " ")[OFFSET(0)]
Any cleaner alternatives?