Can I get UTC offset from Unix command line?

vy32 picture vy32 · May 2, 2011 · Viewed 10.3k times · Source

I'm writing an autoconf script that needs the current UTC offset. There's no obvious way to get this out of the date program. Is there any straightforward way to get this from a command-line utility, or should I write a test that gets the information and somehow captures it?

Answer

Till picture Till · May 2, 2011

Try this, and see whether it works for you:

date +%z