Convert Date to Integer in Swift
<p>I am updating some of my old Swift 2 answers to Swift 3. <a href="https://stackoverflow.com/a/37699089/3681880">My answer</a> to <a href="https://stackoverflow.com/questions/27059292/convert-nsdate-to-an-integer">this question</a>, though, is not easy to update since the question specifically asks for <code>NSDate</code> and not <code>Date</code>. So I am creating a new version of that question that I can update my answer for.</p>

<p><strong>Question</strong></p>

<p>If I start with a <code>Date</code> instance like this</p>

<pre><code>let someDate = Date()
</code></pre>

<p>how would I convert that to an integer?</p>

<p><strong>Related but different</strong></p>

<p>These questions are asking different things:</p>

<ul>
<li><a href="https://stackoverflow.com/questions/26849237/swift-convert-unix-time-to-date-and-time">Swift convert unix time to date and time</a></li>
<li><a href="https://stackoverflow.com/questions/31948226/converting-date-components-integer-to-string">Converting Date Components (Integer) to String</a></li>
<li><a href="https://stackoverflow.com/questions/33202466/convert-date-string-to-int-swift">Convert Date String to Int Swift</a></li>
</ul>