I have anomalous behavior in my bash script and I have found this is the "problem" (it's probably my fault that I don't know the date very well).
If I convert a date in seconds, and try to get a human readable format back, I lost 1 hour
so basically happens this:
~ $ data +%z; date; date -u; data -u +%s
+0200
Sat 24 Sep 2022, 00:02:35, CEST
Fri 23 Sep 2022, 22:02:35, UTC
1663970555
~ $ data -d "1970/01/01 + 1663970555 sec"; date -u -d "1970/01/01 + 1663970555 sec"
Fri 23 Sep 2022, 23:02:35, CEST
Fri 23 Sep 2022, 22:02:35, UTC
What is happening? How can I get the expected result, give "date" 1663970555 seconds and get "Sat 24 Sep 2022, 00:02:35 CEST" back?
I apparently solved with this:
date -ud "1970/01/01 + ${seconds} sec \`date +%:::z\\`"
...but is this the correct way?
Thanks in advance