title: Why is the Ruby Time Zone Designator formatting in strftime not working?
body: <p>I am building <a href="https://support.google.com/webmasters/answer/183668?hl=en&amp;ref_topic=6080646&amp;rd=1" rel="nofollow">a sitemap for Google</a>, and want to use Ruby to format the datetime in their recommended format using the W3C standard with the time zone, like this,</p>
  
  <pre><code>YYYY-MM-DDThh:mmTZD
  </code></pre>
  
  <p>where TZD is the Time Zone Designator. However the default format being exported from the last_updated field from an SQL database by Ruby on Rails has spaces in it, eg</p>
  
  <pre><code>2014-09-19 10:33:05 UTC
  </code></pre>
  
  <p>How do I format the datetime in ruby to remove spaces and include the time zone in the correct format? </p>
  
  <p>TZD can be accessed in ruby using the strftime method, like this:</p>
  
  <pre><code>myobject.updated_at.strftime("%Y-%m-%dT%H:%M:%S%z")
  </code></pre>
  
  <p>This will format time with TZD in the following format</p>
  
  <pre><code>2014-09-26T07:53:14+0000
  </code></pre>
  
  <p>However I need to get the TZD in format +00:00</p>
  
  <p>According to <a href="http://apidock.com/ruby/Time/strftime" rel="nofollow">the Ruby docs</a> I should be able to use </p>
  
  <pre><code>%:z
  </code></pre>
  
  <p>However this shows up as</p>
  
  <pre><code>2014-09-26T08:10:21%:z
  </code></pre>
  
  <p>ruby 1.8.7</p>