# Unix timestamp converter

> Unix timestamp converter: epoch seconds, milliseconds, microseconds or nanoseconds to an ISO 8601 UTC date and local time, and dates back to epoch time.

النسخة التفاعلية: https://www.calcopenly.com/ar/datetime/unix-timestamp-converter
الموضوع: حاسبات التاريخ والوقت

A Unix timestamp counts the seconds since 00:00:00 UTC on 1 January 1970, the Unix epoch, with every day counted as exactly 86,400 seconds. The converter splits the count into whole days and seconds of the day, turns the day number into a calendar date, then applies the chosen zone's offset from the IANA time zone database. Date to timestamp runs the same steps backwards.

Developers use it to read log lines, database columns and API fields. With the unit left on automatic, up to 11 digits are read as seconds, 12 to 14 as milliseconds, 15 to 17 as microseconds and 18 or more as nanoseconds, so 1700000000000 is read as milliseconds: 22:13:20 UTC on 14 November 2023.

Results cover the years 0001 to 9999, the range of a four-digit ISO 8601 year. Negative timestamps are instants before 1970; −86400 is midnight UTC on 31 December 1969.

## المدخلات

- **تحويل الوحدات** (الخيارات: Timestamp to date, Date to timestamp)
- **Timestamp**: Digits (optionally negative or with a decimal part), an ISO 8601 date-time such as 2026-01-15T09:00:00Z, or “now”.
- **Timestamp unit** (الخيارات: Detect from length, Seconds, Milliseconds, Microseconds, Nanoseconds)
- **Date**
- **الوقت**
- **Time zone** (الخيارات: This device's time zone, UTC, Honolulu, Anchorage, Los Angeles, Denver, Phoenix, Chicago, Mexico City, New York, Toronto, Bogotá, Halifax, St John's, Santiago, São Paulo, Buenos Aires, Reykjavík, London, Dublin, Lisbon, Lagos, Casablanca, Paris, Berlin, Madrid, Rome, Amsterdam, Stockholm, Oslo, Johannesburg, Cairo, Athens, Helsinki, Kyiv, Istanbul, Nairobi, Moscow, Riyadh, Tehran, Dubai, Karachi, India (Kolkata), Kathmandu, Dhaka, Bangkok, Jakarta, Singapore, China (Shanghai), Hong Kong, Manila, Perth, Seoul, Tokyo, Adelaide, Brisbane, Sydney, Auckland, Chatham Islands, Kiritimati)
- **If the time happens twice (clocks going back)** (الخيارات: Use the first occurrence, Use the second occurrence)

## النتائج

- ISO 8601 (UTC) — النتيجة الرئيسية
- Local time in the chosen zone
- Unix seconds
- Milliseconds
- Microseconds
- Nanoseconds
- Day of the week (UTC)
- Read as
- Relative to now

## الصيغة

$$
t = 86400 \times N(\text{date}) + 3600h + 60m + s,\qquad N = \text{days since 1970-01-01}
$$

## أمثلة محلولة

### The epoch

- تحويل الوحدات: Timestamp to date
- Timestamp: 0
- Timestamp unit: Seconds
- Time zone: UTC
- **ISO 8601 (UTC): 1970-01-01T00:00:00Z**
- **Day of the week (UTC): Thursday**
- مصدر التحقق: ⁨POSIX definition; Python datetime.fromtimestamp(0, timezone.utc)⁩

### Largest signed 32-bit value (year 2038)

- تحويل الوحدات: Timestamp to date
- Timestamp: 2147483647
- Timestamp unit: Detect from length
- Time zone: UTC
- **ISO 8601 (UTC): 2038-01-19T03:14:07Z**
- **Read as: seconds**
- مصدر التحقق: ⁨Python 3.8: datetime.fromtimestamp(2147483647, timezone.utc)⁩

### Milliseconds shown in India

- تحويل الوحدات: Timestamp to date
- Timestamp: 1700000000000
- Timestamp unit: Detect from length
- Time zone: India (Kolkata)
- **ISO 8601 (UTC): 2023-11-14T22:13:20Z**
- **Local time in the chosen zone: 2023-11-15 03:43:20 (UTC+05:30)**
- **Unix seconds: 1700000000**
- **Read as: milliseconds**
- مصدر التحقق: ⁨Python 3.8: datetime.fromtimestamp(1700000000, tz=Asia/Kolkata) = 2023-11-15 03:43:20+05:30⁩

### Negative timestamp

- تحويل الوحدات: Timestamp to date
- Timestamp: -86400
- Timestamp unit: Seconds
- Time zone: UTC
- **ISO 8601 (UTC): 1969-12-31T00:00:00Z**
- **Day of the week (UTC): Wednesday**
- مصدر التحقق: ⁨Python 3.8: datetime.fromtimestamp(-86400, timezone.utc)⁩

### Nanoseconds keep every digit

- تحويل الوحدات: Timestamp to date
- Timestamp: 1768478400123456789
- Timestamp unit: Detect from length
- Time zone: UTC
- **ISO 8601 (UTC): 2026-01-15T12:00:00.123456789Z**
- **Milliseconds: 1768478400123.456789**
- **Read as: nanoseconds**
- مصدر التحقق: ⁨Python 3.8: datetime.fromtimestamp(1768478400, timezone.utc) = 2026-01-15T12:00:00Z; fraction .123456789 s by definition⁩

### ISO 8601 with an offset, on a leap day

- تحويل الوحدات: Timestamp to date
- Timestamp: 2024-02-29T12:34:56.789+05:30
- Timestamp unit: Detect from length
- Time zone: UTC
- **Unix seconds: 1709190296.789**
- **ISO 8601 (UTC): 2024-02-29T07:04:56.789Z**
- **Read as: ISO 8601 with offset**
- مصدر التحقق: ⁨Python 3.8: datetime.fromisoformat('2024-02-29T12:34:56.789+05:30').timestamp() = 1709190296.789⁩

## الأسئلة

### What is the year 2038 problem?

Software that stores Unix time in a signed 32-bit integer can count only to 2,147,483,647 seconds, reached at 03:14:07 UTC on 19 January 2038. One second later the value wraps to −2,147,483,648, which reads as 20:45:52 UTC on 13 December 1901. A signed 64-bit count, the usual size on current 64-bit systems, lasts about 292 billion years.

### How can I tell whether a timestamp is in seconds or milliseconds?

Count the digits. Present-day times have 10 digits in seconds, 13 in milliseconds, 16 in microseconds and 19 in nanoseconds; the seconds count reached 1,000,000,000 on 9 September 2001 and stays at 10 digits until 20 November 2286. JavaScript's Date.now() and Java's System.currentTimeMillis() return milliseconds, while the shell command date +%s and Python's time.time() return seconds.

### Does Unix time count leap seconds?

No. POSIX defines every day as 86,400 seconds, so the 27 leap seconds added to UTC between 1972 and 2016 have no timestamps of their own, and 23:59:60 cannot be written as Unix time. Systems either repeat a second when one occurs or spread it out; Google, for example, smears a leap second over the 24 hours from noon to noon UTC.

### Is a Unix timestamp the same in every time zone?

Yes. A timestamp names one instant, and the zone only changes how that instant is written. Timestamp 0 is 00:00 UTC on 1 January 1970, which was 05:30 the same day in India, 19:00 on 31 December 1969 in New York, and 01:00 in London, where British Standard Time kept clocks on UTC+01:00 all year from 1968 to 1971.

### How do I get the current Unix timestamp?

Type now in the timestamp box, or ask the system clock: date +%s in a Linux or macOS shell, Math.floor(Date.now() / 1000) in JavaScript, int(time.time()) in Python, and SELECT UNIX_TIMESTAMP() in MySQL. The count grows by 86,400 a day and passes 1,800,000,000 at 08:00 UTC on 15 January 2027.

### ما مدى دقة «⁨Unix timestamp converter⁩»؟

تعتمد الدقة على مدخلاتك وافتراضات الطريقة. يستخدم الحساب العشري 50 رقمًا معنويًا، لكن التقديرات والأساليب العددية وبيانات المصدر قد تكون أقل دقة؛ تقريب القيم المعروضة لا يزيل هذه الحدود. أمثلة محلولة جرى التحقق منها بمصادر مستقلة: 8. مثلًا، يجري التحقق من «⁨The epoch⁩» بالرجوع إلى ⁨POSIX definition; Python datetime.fromtimestamp(0, timezone.utc)⁩.

### ما مصدر هذه الطريقة؟

POSIX.1-2017, §4.16 Seconds Since the Epoch; ISO 8601-1:2019 — Date and time representations; IANA Time Zone Database.

## المصادر

- [POSIX.1-2017, §4.16 Seconds Since the Epoch](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_16)
- ISO 8601-1:2019 — Date and time representations
- [IANA Time Zone Database](https://www.iana.org/time-zones)
