---
title: "#3: Timepiece 🕙"
url: https://littlebitesofcocoa.com/3-timepiece
author: Jake Marsh
date: 2015-05-20
published: 2015-05-20
topics: ["Foundation","Swift","Libraries"]
description: "Timepiece is a library from Naoto Kaneko (github.com/naoty) that makes working with NSDate objects a bit more intuitive."
---

# #3: Timepiece 🕙

By Jake Marsh, May 20, 2015. HTML: https://littlebitesofcocoa.com/3-timepiece

[Timepiece](http://git.io/timepiece) is a library from [Naoto Kaneko](github.com/naoty) that makes working with NSDate objects a bit more intuitive.

``` swift
let now = NSDate()
let theForceAwakens = now + 218.days + 2.hours + 34.minutes
```

It also aids in quickly parsing dates from or rendering dates to a `String`:

``` swift
let judgementDay = "1997-08-29".dateFromFormat("yyyy-MM-dd")
1.day.later.stringFromFormat("EEEE") // "Thursday"
```

Comparisons are simplified as well:

``` swift
if (birthday > 40.years.ago) {
  midLifeCrisis()
}
```

## How to Use Timepiece

In our `Podfile`:

``` ruby
platform :ios, '8.0'

pod 'Timepiece'
```

In any Swift file:

``` swift
import Timepiece
```

More info about **Timepiece** can be found at [git.io/timepiece](http://git.io/timepiece)
