Is there a function in shell that converts date from one format to another. For eg. I want to convert the following PST to CST
2016-11-30 15:55:10-08:00 to
2016-11-30 17:55:10-06:00 Is there a function in shell that converts date from one format to another. For eg. I want to convert the following PST to CST
2016-11-30 15:55:10-08:00 to
2016-11-30 17:55:10-06:00 Not in shell per se, but there is dateutils and with that it's trivial:
$ dateconv '2016-11-30 15:55:10-08:00' -z CST6CDT 2016-11-30T17:55:10 The actual zone names (following -z) should be the ones you installed in /usr/share/zoneinfo/, so equivalently you could use:
$ dateconv '2016-11-30 15:55:10' --from-zone America/Los_Angeles --zone America/Chicago 2016-11-30T17:55:10 Disclaimer: I am the author of the package.