Quantcast
Channel: Active questions tagged bash+awk - Ask Ubuntu
Viewing all articles
Browse latest Browse all 102

How do I get values from string and then convert these values to different time zone?

$
0
0

Data format as follows:

2019 12 18 18 15 05     TIMESTAMP
2019 12 18 23 15 05     TIMESTAMP

These values in strings are respectively year, month, day, hour, minute, and second. I try to write awk script. I could extract these values, not converting ISO 8601 date format (UTC) to UTC+02:00.

What I tried:

awk '/TIMESTAMP/ {print strftime("%FT%T", mktime($1""$2""$3""$4"" $5""$6))}'
2019-12-18T18:15:05 # UTC
2019-12-18T23:15:05 # UTC

Desired output using awk:

2019-12-18T20:15:05 # UTC+02:00:00
2019-12-19T01:15:05 # UTC+02:00:00

Viewing all articles
Browse latest Browse all 102


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