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
Problem solved thanks to @steeldriver
awk '/TIMESTAMP/ {print strftime("%FT%T",(2*3600) + mktime($1" "$2" "$3" "$4" " $5" "$6))}'