Quantcast
Channel: Active questions tagged jq - Stack Overflow
Viewing all articles
Browse latest Browse all 584

Use jq to parse local time into Golang RFC 3339

$
0
0

I have "2024-12-01 00:00:00" in local TZ (Europe/Berlin) and want to parse/convert this into RFC3339 for Go time.Parse which would be "2024-12-01T00:00:00+01:00".

I've tried various variants of

strptime("%Y-%m-%d %H:%M:%S") | strflocaltime("%Y-%m-%dT%H:%M:%S%z")

but I can't get the timezone out in a suitable format since RFC 3339 insists on the ::

RFC3339     = "2006-01-02T15:04:05Z07:00"

and the above format returns

2024-12-01T00:00:00+0100

which is missing the : in the timezone.

How can I get proper timezone format out of the JQ expression (or parse/convert the timestamp so it can be output as UTC)?


Viewing all articles
Browse latest Browse all 584

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>