A time format converter is a tool that takes a time or date value written in one format and produces the same value in another format, without changing the moment it represents. Only the way the value is written changes.
This kind of tool generally handles two related but different jobs. The first is converting how a clock time is written, switching between 12-hour AM/PM notation and 24-hour notation. The second is converting how a complete date and time value is encoded across different systems, such as Unix timestamps, ISO 8601, RFC date formats, and the internal formats used by spreadsheets and databases.
What Is a Unix Timestamp and How Do You Convert It to a Readable Date?
A Unix timestamp, also called epoch time or POSIX time, is the number of seconds that have passed since January 1, 1970, 00:00:00 UTC. Leap seconds are not counted in this figure.
A Unix timestamp is timezone-agnostic. The same number represents the same instant everywhere in the world. The local date and time shown depend only on which timezone you choose to display it in, not on where the number came from.
Converting a Unix timestamp to a readable date works by counting forward that many seconds from January 1, 1970, and expressing the result as a calendar date and clock time, either in UTC or in a timezone you select.
What Is the Difference Between Unix Time in Seconds, Milliseconds, Microseconds and Nanoseconds?
Unix time can be expressed at different levels of precision, and the number of digits in the value is the fastest way to tell them apart.
A 10-digit number is in seconds. A 13-digit number is in milliseconds. A 16-digit number is in microseconds, and a 19-digit number is in nanoseconds.
Most backend languages and databases default to seconds. JavaScript's Date.now() and many web APIs return milliseconds instead. Confusing the two is one of the most common mistakes in date handling, since reading a millisecond value as though it were in seconds shifts the resulting date by decades.
Precision | Digit Count | Example Value | Common Source |
Seconds | 10 | 1784107230 | Most backend languages, databases |
Milliseconds | 13 | 1784107230981 | JavaScript, many web APIs |
Microseconds | 16 | 1784107230981000 | High-precision logging systems |
Nanoseconds | 19 | 1784107230981000000 | Some low-level system clocks |
How Do You Convert a Date Back Into a Unix Timestamp?
Converting in the other direction starts with a calendar date and time and works out how many seconds have passed since the Unix epoch to reach that point.
The result depends on the timezone the input is read in. The same date and clock time, for example 3:00 PM on July 15, produces a different timestamp depending on whether that 3:00 PM is meant in UTC, in a local timezone, or anywhere else. The date and time alone are not enough; the timezone has to be fixed first.
Once the timezone is set, the conversion simply measures the gap in seconds between the epoch and the entered date and time.
What Is the Year 2038 Problem and Why Does It Affect Timestamp Conversion?
Some systems store a Unix timestamp as a signed 32-bit integer, which can only count up to 2,147,483,647. That limit is reached at 03:14:07 UTC on January 19, 2038.
After that point, a 32-bit system's timestamp overflows and wraps around to a negative number, which gets misread as a date in December 1901 rather than 2038.
Modern 64-bit systems are not affected, since a 64-bit integer can count seconds for billions of years. Some older embedded devices and legacy software built on 32-bit integers still are, which is why the Year 2038 problem is still mentioned in timestamp documentation today.
What Are ISO 8601, RFC 2822 and RFC 3339 Time Formats?
ISO 8601 and the RFC date-time standards are standardized, text-based ways of writing a date and time so that different systems can read them without ambiguity. A raw Unix timestamp is a plain number, while these formats are readable strings with a fixed structure.
ISO 8601 is the most common of these formats on the web today. The RFC formats are older but still widely used in specific contexts, such as email headers and HTTP communication.
How Is an ISO 8601 Timestamp Structured?
An ISO 8601 timestamp follows the pattern YYYY-MM-DDTHH:mm:ss.sssZ. The year comes first as four digits, followed by a two-digit month and a two-digit day, separated by hyphens.
A literal letter T separates the date portion from the time portion. After the T come two-digit hours, minutes and seconds, with an optional fraction of a second. A trailing Z means the time is in UTC. A numeric offset such as +05:00 can appear instead of the Z to show a specific timezone.
For example, 2026-07-15T09:20:30Z means 9:20:30 AM UTC on July 15, 2026. Because the format always lists the parts in the same order, from largest unit to smallest, ISO 8601 strings also sort correctly when compared as plain text, which is one reason they are used so widely in software.
What Is the Difference Between RFC 822, RFC 2822, RFC 3339 and RFC 7231 Time Formats?
These are separate standards, each tied to a specific use case, and they are not interchangeable even though they all describe the same kind of information.
Standard | Example Format | Where It Is Used |
RFC 822 / 1036 / 1123 / 2822 | Wed, 15 Jul 2026 09:20:30 +0000 | Email headers, older internet protocols |
RFC 3339 | 2026-07-15T09:20:30Z | A stricter, internet-friendly profile of ISO 8601, used in APIs |
RFC 7231 | Wed, 15 Jul 2026 09:20:30 GMT | Date headers in HTTP requests and responses |
A converter that supports all of these formats typically takes one input value and offers each of these as an output option, rather than requiring a different tool for each standard.
How Do You Convert a Unix Timestamp to ISO 8601 and Back?
Converting from Unix time to ISO 8601 means taking the epoch seconds, resolving them to a calendar date and time in UTC or a chosen timezone, and writing the result with hyphens, a T separator, and a Z or offset.
Going the other way, parsing an ISO 8601 string back into epoch seconds means reading the date, time and timezone offset together, since the offset changes what the underlying timestamp actually is. For example, 1784107230 converts to 2026-07-15T09:20:30Z, and reversing that string returns the same 1784107230 value.
How Do You Convert Time Formats in Different Programming Languages?
Nearly every programming language provides a built-in way to get the current time as a timestamp and to convert between timestamps and formatted date strings, though the exact function names and syntax differ from one language to the next.
The reference below groups common languages by task: getting and converting timestamps in web-first languages, converting timestamps to dates in backend and compiled languages, and converting timestamps directly inside SQL databases.
How Do You Get and Convert the Current Timestamp in Python, JavaScript and PHP?
Language | Get Current Timestamp | Convert Timestamp to Date |
Python | import time; time.time() | time.ctime(timestamp) |
JavaScript | Math.floor(new Date().getTime()/1000) | new Date(timestamp*1000).toLocaleString() |
PHP | time() | date('r', timestamp) |
How Do You Convert a Timestamp to a Date in Java, C#, Go and Ruby?
Language | Get Current Timestamp | Convert Timestamp to Date |
Java | Instant.now().getEpochSecond() | new SimpleDateFormat(pattern).format(new Date(timestamp*1000)) |
C# | DateTimeOffset.Now.ToUnixTimeSeconds() | DateTimeOffset.FromUnixTimeSeconds(timestamp).LocalDateTime |
Go | time.Now().Unix() | time.Unix(timestamp, 0) |
Ruby | Time.at(timestamp) |
How Do You Convert Timestamps Using SQL in MySQL, PostgreSQL, SQL Server and SQLite?
Database timestamp handling matters because most backend applications store event times directly in one of these systems rather than converting them in application code.
Database | Get Current Timestamp | Convert Timestamp to Date |
MySQL | UNIX_TIMESTAMP(NOW()) | FROM_UNIXTIME(timestamp) |
PostgreSQL | EXTRACT(EPOCH FROM now()) | TO_TIMESTAMP(timestamp) |
SQL Server | DATEDIFF(SECOND,'1970-01-01',GETUTCDATE()) | DATEADD(SECOND, timestamp, '1970-01-01') |
SQLite | unixepoch() | datetime(timestamp, 'unixepoch') |
How Do You Convert Time Between Databases, Spreadsheets and Common Apps?
Beyond programming languages, specific applications store time in their own internal formats, and converting between these and a standard timestamp is a common practical need for anyone moving data between systems.
How Do You Convert a Unix Timestamp to Excel Date/Time or OADate?
Excel and LibreOffice Calc store dates as a serial number counting days since a fixed starting point, rather than as seconds since 1970. If a Unix timestamp is already sitting in a cell, the formula =(A1/86400)+25569, applied to a cell formatted as date and time, converts it and returns the value in UTC.
Adjusting for a different timezone means adding or subtracting the offset in seconds before dividing. The underlying serial number Excel uses internally is sometimes called OADate, and readers may come across that term in documentation or other tools.
For a fuller walkthrough of custom time formatting inside Excel, including 12-hour and 24-hour display codes, see the Excel time format guide.
How Do You Convert a Timestamp to a MongoDB ObjectID or Back?
A MongoDB ObjectID embeds a 4-byte Unix timestamp in its first 8 hexadecimal characters. This means every ObjectID can be decoded to reveal roughly when the document was created, alongside a machine identifier and process identifier stored in the remaining bytes.
For a developer who has seen an ObjectID in a database and wants to know it carries a hidden creation time, that is the relevant detail: the leading portion of the string is not random, it is a timestamp in disguise.
How Do You Convert Between 12-Hour and 24-Hour Clock Time?
This is the conversion most people mean when they think about converting time in daily life: switching a clock reading between AM/PM format and 24-hour, or military, format.
Two rules cover almost every case. Converting to 24-hour time means adding 12 to PM hours from 1 through 11. Converting to 12-hour time means subtracting 12 from 24-hour hours from 13 through 23.
What Is the Formula for Converting AM/PM Time to 24-Hour Time and Back?
Converting AM/PM time to 24-hour time:
Input Range | Rule | Example |
12:00-12:59 AM | Subtract 12 (12 becomes 00) | 12:15 AM β 00:15 |
1:00-11:59 AM | Keep the hour the same | 9:15 AM β 09:15 |
12:00-12:59 PM | Keep the hour as 12 | 12:30 PM β 12:30 |
1:00-11:59 PM | Add 12 to the hour | 5:20 PM β 17:20 |
Converting 24-hour time to AM/PM time:
Input Range | Rule | Example |
00:00-00:59 | Add 12 to the hour, label AM | 00:15 β 12:15 AM |
01:00-11:59 | Keep the hour, label AM | 09:15 β 9:15 AM |
12:00-12:59 | Keep the hour as 12, label PM | 12:30 β 12:30 PM |
13:00-23:59 | Subtract 12, label PM | 17:20 β 5:20 PM |
Minutes never change in either direction. Only the hour value and the AM or PM label are affected.
How Do You Handle Midnight and Noon When Converting Clock Formats?
Two edge cases cause most of the confusion in this conversion. 12:00 AM converts to 00:00, marking midnight and the start of the day. 12:00 PM converts to 12:00, marking noon and the middle of the day.
Both 0000 and 2400 are sometimes used to represent midnight in 24-hour notation. 0000 marks the start of a new day, while 2400 is occasionally used in scheduling to mark the close of the previous day. 0000 is the more common and generally accepted form.
What Are the Most Common Mistakes When Converting Time Formats?
Most conversion errors come from one of two sources: mixing up a unit or precision, such as seconds versus milliseconds or AM versus PM, or missing timezone context altogether.
Why Do Seconds and Milliseconds Get Mixed Up in Timestamp Conversion?
Reading a 13-digit millisecond timestamp as if it were in seconds, or the reverse, shifts the resulting date by decades, since the two units differ by a factor of 1000.
For example, 1700000000 read as seconds lands in November 2023. The same digits read as milliseconds land in January 1970. Checking the digit count before converting is the simple way to avoid this.
Why Do People Confuse 12 AM With 12 PM?
The confusion comes from both times sharing the number 12, even though 12 AM is midnight, at the start of the day, and 12 PM is noon, in the middle of the day.
This remains the single most reported mixup connected to clock format, and it is worth double-checking any schedule or form that lists a 12:00 entry without additional context.
Why Does a Missing Time Zone or UTC Offset Cause Conversion Errors?
A Unix timestamp is always based on UTC and carries no timezone information of its own. A plain date-time string such as "2026-07-15 09:20:30" is ambiguous unless a timezone or offset is stated, since different systems may assume UTC, the server's local time, or the reader's own timezone.
The safer practice is to store and exchange time in UTC and convert to a local timezone only when displaying it to a person.
How Does Time Format Conversion Connect to Time Zones and Specialized Timestamp Systems?
Beyond the formats already covered, readers sometimes run into timezone-specific conversion needs, or into timestamps generated by particular systems, such as GPS receivers, distributed ID generators, or platform-specific frameworks, each with its own encoding.
The sections below cover these related situations in more detail, alongside a few formats that are less common day to day but still worth knowing how to read.
How Do You Convert Time Across Different Time Zones and UTC Offsets?
Time format, how a value is written, and time zone, what the local time actually is, are separate problems that often need solving together, since a converted timestamp is frequently also displayed in a specific region's local time.
A UTC timestamp, for instance, needs to be shown correctly to users in different regions at the same moment, each seeing their own local hour.
For zone-by-zone conversion and current offsets, use a dedicated time zone converter.
How Do You Convert a Julian Day Number to a Calendar Date?
Julian Day is a continuous day count used in astronomy and some scientific and historical fields, counted from a fixed starting point in 4713 BCE. It is distinct from the everyday Julian calendar, despite the similar name.
This is a niche format that most readers will not need for everyday scheduling, but it does appear in astronomy software and some legacy scientific datasets.
A dedicated Julian day converter handles the calculation directly.
What Is GPS Time and How Is It Different From UTC?
GPS time is a continuous count of seconds since January 6, 1980. Unlike UTC, it does not apply leap seconds, so the two have drifted apart by a growing number of seconds over the decades.
This distinction matters mainly to developers working with GPS hardware, navigation systems, or satellite data, where the raw time value received from a device is in GPS time rather than UTC.
A GPS time converter accounts for the current leap-second offset automatically.
How Do You Convert .NET DateTime Ticks to a Readable Date?
.NET stores time internally as ticks, where one tick equals 100 nanoseconds, counted from January 1 of year 1 rather than from the Unix epoch. This is why a raw ticks value looks unfamiliar to developers used to working with Unix time.
This matters specifically for C# and .NET developers reading raw DateTime.Ticks values out of logs or serialized data.
A .NET DateTime ticks converter translates a ticks value into a standard date directly.
How Do You Decode a Snowflake ID or ULID Into a Timestamp?
Snowflake IDs, used by platforms such as Discord and X, and ULIDs are unique identifiers that embed a creation timestamp in their leading bits or characters, similar in concept to a MongoDB ObjectID but with a different bit layout.
This matters to developers debugging the order records were created in, or building systems that need sortable unique identifiers rather than random ones.
A Snowflake ID and ULID timestamp converter extracts the embedded timestamp for you.
How Do You Use strftime Codes to Format Time in Code?
strftime is a formatting system used across languages such as Python, C, PHP and Ruby, where codes like %H, %I, %M and %p control how a time value becomes a text string.
This connects directly to the 12-hour and 24-hour distinction covered earlier: %H produces 24-hour hours, %I produces 12-hour hours, and %p adds the AM or PM label.
For the full list of codes and examples in each language, see the strftime format cheat sheet.
What Is Decimal Time and How Is It Different From Standard Time?
Decimal time divides the day into decimal fractions instead of the standard 60-minute hours and 60-second minutes. It is rarely used today outside specific scientific, payroll, or historical contexts.
It is not part of ISO 8601 and is not something most readers will need for day-to-day scheduling, but it does still appear in a handful of specialized fields.
Readers who do need it can use a decimal time converter to move between the two systems.
How Do You Convert a Date From One Format to Another?
Date format conversion, such as MM/DD/YYYY versus DD/MM/YYYY versus YYYY-MM-DD, is a closely related but separate problem from everything covered above. Mixing up date format with time format confusion is common, since a date can be misread entirely depending on regional convention even when the time portion is correct.
For example, 05/06/2026 means May 6 in the United States and June 5 in most of Europe.
A dedicated date format converter handles this conversion directly.

