Time and Data Conversion
Digital and time conversions often fail because the labels look simple while the assumptions are not. This guide explains decimal vs binary storage, elapsed durations, IANA time zones, and Unix timestamp units.
Key distinction
1 MB is not 1 MiB
Decimal storage uses powers of 1000; binary IEC storage uses powers of 1024.
Common time and data assumptions
| Topic | Rule | Common mistake | Tool |
|---|---|---|---|
| Data storage | 1 MiB = 2^20 B; 1 MB = 10^6 B | Mixing MB and MiB | Open converter |
| Durations | 1 day = 86,400 elapsed seconds | Using duration months as calendar months | Open converter |
| Time zones | Use IANA zones for date-aware offsets | Using fixed UTC offsets for future meetings | Open converter |
| Unix time | 0 = 1970-01-01T00:00:00Z | Mixing seconds and milliseconds | Open converter |
Storage: label the prefix system
Use MB and GB for decimal powers of 1000. Use MiB and GiB for binary powers of 1024. Keeping the label honest avoids capacity confusion.
Durations: separate elapsed time from dates
Seconds, minutes, and hours are fixed elapsed units. Months and years are calendar concepts unless an average-duration assumption is clearly stated.
Time zones: use date-aware rules
Timezone offsets can change by date. IANA zone names preserve location rules better than a fixed UTC offset copied into a meeting note.
Unix time: label seconds vs milliseconds
Unix timestamps are often seconds, while JavaScript Date values are milliseconds. A factor-of-1000 mismatch creates obvious but costly bugs.
How to choose the correct digital or time conversion
Start by identifying whether the value is a quantity, a duration, or a moment. Data sizes are quantities and can be converted through bits. Durations are elapsed amounts and can be converted through seconds. Timestamps represent a moment in time and should usually be stored in UTC, then displayed in local time zones.
Time zones require extra care because offsets are not fixed for every date. The IANA time zone database exists because civil time changes with daylight saving rules and political decisions. For meetings, use a location-based zone name and keep the meeting date visible.
References used for Day 15 converters
NIST Binary Prefixes
Reference material for binary prefixes, civil time-zone data, and JavaScript date/timestamp behavior.
IANA Time Zone Database
Reference material for binary prefixes, civil time-zone data, and JavaScript date/timestamp behavior.
MDN JavaScript Date
Reference material for binary prefixes, civil time-zone data, and JavaScript date/timestamp behavior.
Time and data conversion questions
What is the difference between decimal and binary data units?
Decimal data units use powers of 1000, so 1 MB is 1,000,000 bytes. Binary IEC units use powers of 1024, so 1 MiB is 1,048,576 bytes. Confusing those labels is a common reason storage values look different between product labels, operating systems, and technical documentation.
Are duration conversions the same as calendar date math?
No. Duration conversion treats time as elapsed seconds, minutes, hours, or days. Calendar date math depends on the specific month, leap years, daylight saving transitions, and local timezone rules. Use duration conversion for elapsed time, and date-aware tools for calendar scheduling.
Why should timezone tools use IANA names?
IANA timezone names such as America/New_York and Asia/Dubai represent location-based civil time rules. They are safer than fixed offsets for meeting planning because daylight saving time and regional rule changes can alter the offset for a specific date.
What is a Unix timestamp?
A Unix timestamp counts elapsed time from 1970-01-01 00:00:00 UTC. Many systems store it as seconds, while JavaScript Date values use milliseconds. Mixing seconds and milliseconds is a common timestamp debugging mistake.
When should I store UTC instead of local time?
UTC is usually the safest storage format for logs, events, database fields, and API timestamps. Local time is best treated as a display view of the same instant because timezone offsets can change by date and by region.