How to format time intervals for user display (social network like) in swift?
<p>I have a time interval, say, 12600, which is equivalent to 3 hours 30 minutes. How could I format any such time interval so that only the highest part of the interval (for example in this case figure, the hours) is kept and have the correct locale abbreviation be appended to the number. For example 10m (10 minutes), 3d (3 days), 1y (1 years).</p>

<hr>

<p>EDIT: Here are some examples:</p>

<pre>
Time interval in: 90000    Whole string: 1d      String out: 1d
Time interval in: 900      Whole string: 15m     String out: 15m
Time interval in: 13500    Whole String: 3h 45m  String out: 4h
</pre>

<p>As a general rule, apply the normal rounding rules (3.4 rounds down, 3.6 rounds up).</p>