Convert Apple and Cocoa timestamps to Unix time, ISO 8601 dates, and local times for Swift, Objective-C, and Foundation-based apps.
Apple / Cocoa to Unix example
Cocoa timestamp 0 represents January 1, 2001 at 00:00 UTC. Add 978307200 to Cocoa seconds to get Unix seconds. Select Apple / Cocoa below to convert your own value.
Seconds since January 1, 2001 UTC. Supports up to three decimal places; nanosecond values are not supported.
Please enter a valid Apple / Cocoa timestamp within the supported date range.
Please enter a valid calendar date and time. February has 28 days, or 29 in a leap year. April, June, September, and November have 30 days.
Please select a timezone from the list.
Please select a timezone from the list.
Result
Timezone
—
Offset
—
Earlier occurrence
—
Timezone
—
Offset
—
Unix timestamp
—
Later occurrence
—
Timezone
—
Offset
—
Unix timestamp
—
Other formats
Convert a time to see its formats.
Unix seconds
—
Unix milliseconds
—
ISO 8601 — UTC
—
ISO 8601 — destination timezone
—
RFC 3339 — UTC
—
HTTP date — GMT
—
Earlier occurrence
Unix seconds
—
Unix milliseconds
—
ISO 8601 — UTC
—
ISO 8601 — destination timezone
—
RFC 3339 — UTC
—
HTTP date — GMT
—
Later occurrence
Unix seconds
—
Unix milliseconds
—
ISO 8601 — UTC
—
ISO 8601 — destination timezone
—
RFC 3339 — UTC
—
HTTP date — GMT
—
ISO 8601 and RFC 3339 UTC values match for ordinary dates. HTTP dates use whole seconds. RFC 3339 and HTTP dates require a four-digit year.
Show code for your converted time
Your converted time in code
Examples use the resolved instant and destination timezone. JavaScript uses Unix milliseconds; PHP parses an explicit UTC date; Python uses timezone-aware dates. Ruby uses TZInfo for named time zones. Java and C++ start from Unix milliseconds. None rely on your computer’s default timezone.
Repeated local times get two separate examples. These reproduce your resolved conversion; they do not validate arbitrary local-time input. JavaScript display text and timezone rules can vary with runtime locale data. PHP examples support four-digit years. Python requires 3.9+ and supports years 1–9999. If timezone data is missing, install it with python -m pip install tzdata. Ruby requires the TZInfo 2.x gem and timezone data (install tzinfo-data if needed). Ruby examples support years 0000–9999 in UTC and the destination timezone. Java requires 8+. C++ requires a C++20 standard library with chrono timezone support, std::format, and installed IANA timezone data. Java and C++ examples support years 0000–9999 in UTC and the destination timezone.
What is an Apple / Cocoa timestamp?
Apple and Cocoa timestamps count seconds from January 1, 2001 at 00:00:00 UTC. They are often used in Swift, Objective-C, and Foundation APIs. The epoch is different from Unix time, so a Cocoa value must be converted before it matches a standard Unix timestamp.
The conversion is straightforward: Unix seconds = Cocoa seconds + 978307200. If you want to convert from Unix to Cocoa instead, subtract 978307200 from the Unix timestamp. The same approach works for fractional seconds, though many Cocoa values are expressed with up to three decimal places.
For example, Cocoa timestamp 0 is 2001-01-01T00:00:00Z, which is Unix timestamp 978307200. A much larger value like 1700000000 corresponds to a date after 2023, but the exact local time depends on the timezone you choose for display.
This page uses the same conversion engine as the main Timeplain tool, so the datetime output and the generated code samples stay aligned with the selected timezone and format.
Apple / Cocoa timestamp questions
How do I convert an Apple / Cocoa timestamp to Unix time?
Add 978307200 to the Cocoa value to get Unix seconds. For example, Cocoa timestamp 0 is Unix timestamp 978307200, or 2001-01-01T00:00:00Z.
Are Cocoa timestamps measured in seconds or milliseconds?
Foundation Date values are seconds from 2001-01-01 00:00:00 UTC and can include fractional seconds. This converter accepts up to three fractional digits; it does not accept nanosecond counts.
Does a timezone change the Cocoa timestamp?
No. The Cocoa value identifies an instant relative to the 2001 UTC epoch. A selected timezone changes only the local date and time shown for that instant.
Feedback
Have a suggestion, spotted a problem, or need another date format? Help shape what comes next for Timeplain.