How can I format date -u so that the results include timezone offset in a Mac OSX terminal session?
Question
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.
Solution
Try this:
echo `date -u` `date +%z`
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow