views:

162

answers:

1

In a terminal session I can use date -u to get
Mon Mar 16 03:34:39 2009 UTC
However, I'd like to include the offset. I'm modifying a TextMate tab trigger so that I can insert the full date including the local offset, in standard UTC format. I believe that would be in the following form: Mon Mar 16 03:34:39 2009 UTC -0500

So, as you can see, I don't know how to get the timezone offset and combine that with formatted date results.

+2  A: 

Try this:

echo `date -u` `date +%z`
John Feminella
Replaced date -u +%z by date +%z. the first one would always return +0000.
mouviciel
Whoops, good catch. Thanks for the fix.
John Feminella
That's perfect, thank you very much!
Michael Prescott