Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I format date -u so that the results include timezone offset in a Mac OSX terminal session?

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.


1 Answers

Try this:

echo `date -u` `date +%z`
like image 57
John Feminella Avatar answered Sep 06 '25 14:09

John Feminella



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!