Mac HFS+ Timestamp Converter - HFS Plus Seconds Since 1904
HFS+ Timestamp to Date
0x hex value, compact hex, or spaced hex bytes.Forensic interpretations
| Interpretation | Decimal HFS+ | Hex | UTC date |
|---|
The swapped-byte preview is shown for 4-byte values so copied disk bytes can be compared as big-endian and little-endian quickly.
Date to HFS+ Timestamp
Display Settings
2,082,844,800 seconds.Advertisement
Batch Decode HFS+ Values
About HFS+ Time
HFS+, also known as HFS Plus or Mac OS Extended, stores file-system timestamps as whole seconds since 1904-01-01T00:00:00Z. Compared with Unix time, the exact epoch gap is 2,082,844,800 seconds.
- HFS+ to Unix seconds:
unix = hfs - 2,082,844,800 - Unix seconds to HFS+:
hfs = unix + 2,082,844,800 - Endianness: HFS Plus on-disk structures are big-endian; little-endian previews help when raw bytes were copied in reverse order.
- Range: an unsigned 32-bit HFS+ timestamp spans
1904-01-01T00:00:00Zthrough2040-02-06T06:28:15Z. The often-cited2106date is Unix unsigned 32-bit overflow, not HFS+ unsigned 32-bit overflow.
HFS+ Time Code Examples
Compact examples for converting between HFS+ seconds since 1904-01-01 UTC and human time. Example input 2082844800 decodes to 1970-01-01T00:00:00Z.
const HFS_OFFSET = 2082844800n;
function hfsToDate(hfs) {
return new Date(Number((BigInt(hfs) - HFS_OFFSET) * 1000n));
}
function dateToHfs(date) {
return BigInt(Math.floor(date.getTime() / 1000)) + HFS_OFFSET;
}
console.log(hfsToDate(2082844800n).toISOString()); // 1970-01-01T00:00:00.000Z
import datetime
HFS_OFFSET = 2_082_844_800
def hfs_to_datetime(hfs: int) -> datetime.datetime:
return datetime.datetime.fromtimestamp(hfs - HFS_OFFSET, datetime.timezone.utc)
def datetime_to_hfs(dt: datetime.datetime) -> int:
return int(dt.timestamp()) + HFS_OFFSET
print(hfs_to_datetime(2082844800).isoformat()) # 1970-01-01T00:00:00+00:00
let hfsOffset: TimeInterval = 2_082_844_800
func hfsToDate(_ hfs: TimeInterval) -> Date {
Date(timeIntervalSince1970: hfs - hfsOffset)
}
func dateToHfs(_ date: Date) -> TimeInterval {
date.timeIntervalSince1970 + hfsOffset
}
print(ISO8601DateFormatter().string(from: hfsToDate(2_082_844_800))) // 1970-01-01T00:00:00Z
#include <stdint.h>
#define HFS_OFFSET 2082844800LL
int64_t hfs_to_unix(uint32_t hfs) {
return (int64_t)hfs - HFS_OFFSET;
}
uint32_t unix_to_hfs(int64_t unix_seconds) {
return (uint32_t)(unix_seconds + HFS_OFFSET);
}
/* hfs_to_unix(2082844800u) == 0, or 1970-01-01T00:00:00Z */
Known HFS+ Timestamp Values
| Value | Meaning | UTC date |
|---|---|---|
0 | Start of the HFS+ epoch | 1904-01-01T00:00:00Z |
2082844800 | Unix epoch offset in decimal | 1970-01-01T00:00:00Z |
0x7C25B080 | Unix epoch offset in hexadecimal | 1970-01-01T00:00:00Z |
4294967295 | Maximum unsigned 32-bit HFS+ timestamp | 2040-02-06T06:28:15Z |
4294967296 | Next second wraps to 0 in unsigned 32-bit fields | 1904-01-01T00:00:00Z after wrap |
HFS+ Timestamp FAQ
What is a Mac HFS+ timestamp?
A Mac HFS+ timestamp, also called an HFS Plus timestamp or Mac OS Extended timestamp, counts whole seconds since January 1, 1904 at 00:00:00 GMT/UTC.
Is Mac timestamp the same as Cocoa/Core Data time?
No. HFS+ time starts at 1904-01-01 UTC. Cocoa and Core Data absolute time start at 2001-01-01 UTC, so the numeric values are different even when they describe the same instant.
Does HFS+ use UTC or local time?
HFS Plus timestamps are defined as seconds from the 1904 epoch in GMT/UTC. This tool decodes to UTC first and then shows the selected local time zone for convenience.
Why does HFS+ start in 1904?
The classic Mac epoch starts at 1904-01-01, which begins a leap-year cycle and avoids the special 1900 leap-year rule that complicates calendar arithmetic.
What happens in 2040?
An unsigned 32-bit HFS+ field reaches 4294967295 at 2040-02-06T06:28:15Z. If a field is limited to 32 bits, the next second wraps to 0, which represents 1904-01-01T00:00:00Z.
How do I convert HFS+ to Unix time?
Subtract 2,082,844,800 from the HFS+ timestamp. Add the same offset to convert Unix seconds back to HFS+ seconds.
Is HFS+ big-endian?
Yes. HFS Plus volume structures are big-endian on disk. If you have copied four raw bytes from a little-endian view, use the little-endian input mode or compare the swapped-byte preview.
Which file metadata fields use HFS+ timestamps?
HFS Plus catalog records use timestamp fields for metadata such as creation time, content modification time, attribute modification time, access time, and backup time.
References and Accuracy Notes
- Apple Technical Note TN1150: HFS Plus Volume Format for the HFS Plus epoch, catalog fields, and big-endian volume structures.
- Epoch Converter Mac HFS+ timestamp converter for current Mac timestamp comparison.
- Digital Detective DCode for forensic timestamp decoding workflows and endian-oriented input examples.
- File-system date-range reference for the HFS/HFS Plus range ending at 2040-02-06 06:28:15 UTC for 32-bit timestamp fields.
