Nick ONeill Nick ONeill - 1 year ago 40
Ruby Question

How do you get the local timezone offset in "+hh:mm" format?

I know how to get the current utc_offset using

but how can I get it in the format "+hh:mm"?

The best solution I have so far is[-6,6]


strftime with %z (: means hour and minute offset from UTC with a colon):