title: Swift 3 - UTC to time ago label, thinking 12h / 24h device time changes
body: <p>I want to convert timeUTC to "5s ago." ago label also thinking 12h / 24h changes on the phone. Because goes crash. Now below lines of code return label value what I want in the Playground. But not on my ios project. It doesn't go into If block. What I'm missing or What's the wrong with that?</p>
  
  <pre><code>    let dateStringUTC = "2016-10-22 12:37:48 +0000"
      let dateFormatter = DateFormatter()
      dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss ZZZ"
  
      if let from = dateFormatter.date(from: dateStringUTC) {
  
          dateFormatter.dateFormat = "MMM d, yyyy h:mm:ss a"
          let stringFromDate = dateFormatter.string(from: from)
          let dateLast = dateFormatter.date(from: stringFromDate)
  
          let now = Date()
          let components: NSCalendar.Unit = [.second, .minute, .hour, .day, .weekOfMonth]
          let difference = (Calendar.current as NSCalendar).components(components, from: dateLast!, to: now, options: [])
  
          if difference.second! &lt;= 0 {
              self.timeInfoLbl.text = "now"
          }
          if difference.second! &gt; 0 &amp;&amp; difference.minute! == 0 {
              self.timeInfoLbl.text = String(describing: difference.second!) + "s."
          }
          if difference.minute! &gt; 0 &amp;&amp; difference.hour! == 0 {
              self.timeInfoLbl.text = String(describing: difference.minute!) + "m."
          }
          if difference.hour! &gt; 0 &amp;&amp; difference.day! == 0 {
              self.timeInfoLbl.text = String(describing: difference.hour!) + "h."
          }
          if difference.day! &gt; 0 &amp;&amp; difference.weekOfMonth! == 0 {
              self.timeInfoLbl.text = String(describing: difference.day!) + "d."
          }
          if difference.weekOfMonth! &gt; 0 {
              self.timeInfoLbl.text = String(describing: difference.weekOfMonth!) + "w."
  
              if difference.weekOfMonth! &gt; 52 {
                  let number = Float(difference.weekOfMonth!) / 52
                  let strYear = String(format:"%.1f", number)
                  self.timeInfoLbl.text = strYear + " year"
              }
          }
      }
  </code></pre>