Fix DateTime->format() flags 'e' and 'T' for offset time zones.

Adapted from https://github.com/php/php-src/ to resolve https://github.com/facebook/hhvm/issues/1731. The issue also occurred for the 'e' flag, so that was fixed here too. Someone more familiar with the code can probably clean this up significantly.