# UNIX timestamp konverter

> Konverter UNIX timestamp til dato og tid og omvendt. Se aktuelt timestamp i realtid, lokal tid, UTC og relativ tid. En gratis online UNIX tid omformer.

URL: https://acrafto.com/da/unix-timestamp-konverter/

Tools are interactive browser apps; there is no public API, no endpoints to call and no server-side processing. To use a tool, open its HTML page in a browser.

## UNIX Timestamp Konverter (online UNIX tid omformer)

Denne **UNIX timestamp konverter** gør det muligt hurtigt at konvertere **UNIX tid (epoch time / POSIX time)** til **dato og tid** og omvendt. Den understøtter **timestamps i sekunder og millisekunder**, viser **lokal tid**, **UTC** og **ISO 8601**, og resultater kan **kopieres** med et enkelt klik.

---

## Hvad er et UNIX timestamp (epoch time / POSIX time)?

**UNIX timestamp** er et tal, der udtrykker tid som **antallet af sekunder siden 1. januar 1970 00:00:00 UTC** (den såkaldte **UNIX epoch**). I praksis er det et af de mest anvendte formater til lagring og overførsel af dato og tid i systemer, databaser, API’er og logning.

**Eksempel:** `1700000000` svarer til datoen **14\. november 2023 22:13:20 UTC**.

### Hvorfor lige 1. januar 1970?

Starten af epoken (1970-01-01) blev valgt under designet af UNIX som et praktisk referencepunkt: det er tæt på systemets skabelsesperiode og muliggør simple tidsberegninger.

---

## UNIX timestamp i sekunder vs. millisekunder

UNIX timestamp forekommer oftest i to former:

| Timestamp format | Eksempel | Typisk anvendelse |
| --- | ---: | --- |
| **Sekunder (s)** | `1700000000` | databaser, backend, API, filer |
| **Millisekunder (ms)** | `1700000000000` | JavaScript (`Date.now()`), analyse, detaljerede logs |

**Hvordan ved du, hvad du har?**

- **Sekunder** har for “dagens” datoer typisk **10 cifre**.
- **Millisekunder** har typisk **13 cifre** og er omkring **1000 gange større**.
- Som en tommelfingerregel: hvis værdien er **\> 10¹²**, er det næsten helt sikkert **millisekunder**.

---

## Sådan bruges UNIX timestamp konverteren

### 1) Timestamp → Dato og tid

1. Indtast **UNIX timestamp** i feltet, eller klik på **Nu** (aktuel UNIX tid).
2. Hvis timestampet er i **millisekunder**, aktiver da indstillingen **Millisekunder**.
3. Klik på **Konverter** (eller tryk Enter).
4. Konverteringen til **lokal tid**, **UTC** og **ISO 8601** vil blive vist.
5. Klik på resultatet for at **kopiere det til udklipsholderen**.

### 2) Dato og tid → Timestamp

1. Vælg **dato og tid** i formularen.
2. Klik på **Konverter**.
3. Resultatet vises som **timestamp i sekunder og millisekunder**.

---

## Hvor bruges UNIX timestamp oftest?

UNIX tid findes praktisk talt overalt, hvor man arbejder med tid inden for IT:

- **Databaser** – lagring af tider og sammenligning i MySQL, PostgreSQL, SQLite mv.
- **API’er** – REST/GraphQL returnerer ofte tid som et timestamp (nem serialisering).
- **Logs og overvågning** – præcis sortering af begivenheder i tid.
- **Git** – commits indeholder tidsdata.
- **Filsystemer** – tider som mtime/ctime/atime (sidste ændring mv.).
- **JWT** – claims `iat` (issued at) og `exp` (expires) er typisk i epoch sekunder.
- **Linux/Unix shell** – `date +%s` returnerer det aktuelle timestamp.
- **JavaScript** – `Date.now()` returnerer tid i **millisekunder**.

---

## Praktiske eksempler på konvertering af UNIX tid

### JavaScript (timestamp ↔ dato)

```
// Aktuelt UNIX timestamp i sekunder
const tsSeconds = Math.floor(Date.now() / 1000);

// Aktuelt timestamp i millisekunder
const tsMs = Date.now();

// Timestamp (s) -> dato
const dateFromSeconds = new Date(1700000000 * 1000);
console.log(dateFromSeconds.toISOString());

// Dato -> timestamp (s)
const ts = Math.floor(new Date("2024-01-01T00:00:00Z").getTime() / 1000);
console.log(ts);
```

### Python (timestamp ↔ datetime)

```
import time
from datetime import datetime, timezone

# Aktuelt timestamp i sekunder
ts = int(time.time())

# Timestamp -> datetime (UTC)
dt_utc = datetime.fromtimestamp(1700000000, tz=timezone.utc);

# Dato -> timestamp
ts2 = int(datetime(2024, 1, 1, tzinfo=timezone.utc).timestamp());
```

### SQL (MySQL)

```
-- Aktuelt UNIX timestamp (s)
SELECT UNIX_TIMESTAMP();

-- Timestamp -> dato
SELECT FROM_UNIXTIME(1700000000);

-- Dato -> timestamp
SELECT UNIX_TIMESTAMP('2024-01-01 00:00:00');
```

---

## Tidszoner: UTC, lokal tid og ISO 8601

**UNIX timestamp er altid i UTC** – det indeholder ingen information om tidszone eller sommertid. Konverteringen til lokal tid afhænger af browserens, serverens eller det anvendte biblioteks indstillinger.

Begreber, der er gode at kende:

- **UTC** – en global standard uden sommer-/vintertid.
- **GMT** – for almindelig brug praktisk talt identisk med UTC.
- **Offset** – forskydning i forhold til UTC (f.eks. København **UTC+1** om vinteren, **UTC+2** om sommeren).

---

## Grænser for UNIX timestamp og År 2038 Problemet

### År 2038 Problemet (Year 2038 Problem)

På visse **32-bit systemer** lagres timestampet som en `int32` med et maksimum på **2.147.483.647**, hvilket svarer til **19\. januar 2038 03:14:07 UTC**. Efter overskridelse kan der opstå overflow og forkert tid. Moderne **64-bit** systemer har typisk ikke dette problem.

### Rækkevidde af 64-bit UNIX tid

64-bit værdier dækker et ekstremt bredt tidsrum (i praksis “for evigt”). Negative værdier betyder datoer **før 1. januar 1970**.

---

## FAQ – Ofte stillede spørgsmål om UNIX timestamp

### Er UNIX timestamp i UTC, eller i lokal tid?

UNIX timestamp er altid i **UTC**. Lokal tid opstår først ved konvertering i henhold til tidszonen. Konverteren viser derfor typisk både UTC og lokal tid.

### Hvordan ved jeg, om timestampet er i sekunder eller millisekunder?

For den nuværende tid har et timestamp i **sekunder** typisk **10 cifre**. I **millisekunder** har det typisk **13 cifre** og er cirka **1000 gange større**. Som en tommelfingerregel: en værdi **\> 10¹²** er normalt millisekunder.

### Hvad betyder et negativt UNIX timestamp?

Et negativt timestamp repræsenterer en dato **før 1. januar 1970**. For eksempel svarer `-1` til **31\. december 1969 23:59:59 UTC**.

### Hvordan konverteres UNIX timestamp i SQL?

I MySQL bruger du `FROM_UNIXTIME(timestamp)` og tilbage `UNIX_TIMESTAMP(dato)`. I PostgreSQL er det typisk `TO_TIMESTAMP(timestamp)` og `EXTRACT(EPOCH FROM dato)`.

### Hvorfor starter UNIX-epoken den 1. januar 1970?

Det er et historisk valgt referencepunkt fra de tidlige dage af UNIX: enkelt, praktisk og tæt på systemets udviklingstidspunkt.

## Other languages

- Čeština (cs): [Unix timestamp převodník](https://acrafto.com/cs/unix-timestamp/) ([Markdown](https://acrafto.com/cs/unix-timestamp/index.md))
- Slovenčina (sk): [Unix timestamp konvertor](https://acrafto.com/sk/unix-timestamp-prevodnik/) ([Markdown](https://acrafto.com/sk/unix-timestamp-prevodnik/index.md))
- English (en): [UNIX Timestamp Converter](https://acrafto.com/en/unix-timestamp-converter/) ([Markdown](https://acrafto.com/en/unix-timestamp-converter/index.md))
- Deutsch (de): [Unix Timestamp umrechnen](https://acrafto.com/de/unix-timestamp-konverter/) ([Markdown](https://acrafto.com/de/unix-timestamp-konverter/index.md))
- Français (fr): [Convertisseur timestamp Unix](https://acrafto.com/fr/convertisseur-timestamp-unix/) ([Markdown](https://acrafto.com/fr/convertisseur-timestamp-unix/index.md))
- Español (es): [Convertidor de UNIX timestamp](https://acrafto.com/es/convertidor-timestamp-unix/) ([Markdown](https://acrafto.com/es/convertidor-timestamp-unix/index.md))
- Italiano (it): [Convertitore timestamp UNIX](https://acrafto.com/it/convertitore-timestamp-unix/) ([Markdown](https://acrafto.com/it/convertitore-timestamp-unix/index.md))
- Português (pt): [Conversor de timestamp Unix](https://acrafto.com/pt/conversor-timestamp-unix/) ([Markdown](https://acrafto.com/pt/conversor-timestamp-unix/index.md))
- Nederlands (nl): [Unix timestamp converter](https://acrafto.com/nl/unix-timestamp-converter/) ([Markdown](https://acrafto.com/nl/unix-timestamp-converter/index.md))
- Polski (pl): [Konwerter UNIX timestamp](https://acrafto.com/pl/konwerter-unix-timestamp/) ([Markdown](https://acrafto.com/pl/konwerter-unix-timestamp/index.md))
- Română (ro): [Convertor Unix timestamp](https://acrafto.com/ro/convertor-unix-timestamp/) ([Markdown](https://acrafto.com/ro/convertor-unix-timestamp/index.md))
- Magyar (hu): [UNIX időbélyeg konvertáló](https://acrafto.com/hu/unix-idobelyeg-atalakito/) ([Markdown](https://acrafto.com/hu/unix-idobelyeg-atalakito/index.md))
- Ελληνικά (el): [Μετατροπέας Unix timestamp](https://acrafto.com/el/unix-timestamp-converter/) ([Markdown](https://acrafto.com/el/unix-timestamp-converter/index.md))
- Български (bg): [Unix timestamp конвертор](https://acrafto.com/bg/unix-timestamp-konverter/) ([Markdown](https://acrafto.com/bg/unix-timestamp-konverter/index.md))
- Hrvatski (hr): [Unix timestamp konverter](https://acrafto.com/hr/unix-timestamp-konverter/) ([Markdown](https://acrafto.com/hr/unix-timestamp-konverter/index.md))
- Slovenščina (sl): [Pretvornik Unix timestamp](https://acrafto.com/sl/unix-timestamp-pretvornik/) ([Markdown](https://acrafto.com/sl/unix-timestamp-pretvornik/index.md))
- Eesti (et): [UNIX timestamp teisendaja](https://acrafto.com/et/unix-timestamp-teisendaja/) ([Markdown](https://acrafto.com/et/unix-timestamp-teisendaja/index.md))
- Latviešu (lv): [UNIX laika zīmogu pārveidotājs](https://acrafto.com/lv/unix-timestamp-konvertetajs/) ([Markdown](https://acrafto.com/lv/unix-timestamp-konvertetajs/index.md))
- Lietuvių (lt): [UNIX laiko žymės keitiklis](https://acrafto.com/lt/unix-laiko-zymes-keitiklis/) ([Markdown](https://acrafto.com/lt/unix-laiko-zymes-keitiklis/index.md))
- Svenska (sv): [Unix timestamp-omvandlare](https://acrafto.com/sv/unix-timestamp-omvandlare/) ([Markdown](https://acrafto.com/sv/unix-timestamp-omvandlare/index.md))
- Suomi (fi): [UNIX-aikaleiman muunnin](https://acrafto.com/fi/unix-aikaleiman-muunnin/) ([Markdown](https://acrafto.com/fi/unix-aikaleiman-muunnin/index.md))
- Norsk (no): [Unix timestamp-konverterer](https://acrafto.com/no/unix-tidsstempel-konverterer/) ([Markdown](https://acrafto.com/no/unix-tidsstempel-konverterer/index.md))
- Українська (uk): [Конвертер Unix timestamp](https://acrafto.com/uk/konverter-unix-chasu/) ([Markdown](https://acrafto.com/uk/konverter-unix-chasu/index.md))
- Русский (ru): [Unix timestamp конвертер](https://acrafto.com/ru/unix-timestamp-konverter/) ([Markdown](https://acrafto.com/ru/unix-timestamp-konverter/index.md))
- Српски (sr): [UNIX timestamp konverter](https://acrafto.com/sr/unix-timestamp-konverter/) ([Markdown](https://acrafto.com/sr/unix-timestamp-konverter/index.md))
- Македонски (mk): [UNIX timestamp конвертор](https://acrafto.com/mk/unix-timestamp-konvertor/) ([Markdown](https://acrafto.com/mk/unix-timestamp-konvertor/index.md))
- Bosanski (bs): [Unix timestamp konverter](https://acrafto.com/bs/unix-timestamp-konverter/) ([Markdown](https://acrafto.com/bs/unix-timestamp-konverter/index.md))
- Shqip (sq): [Konvertues Unix timestamp](https://acrafto.com/sq/konvertues-timestamp-unix/) ([Markdown](https://acrafto.com/sq/konvertues-timestamp-unix/index.md))
- Türkçe (tr): [UNIX zaman damgası dönüştürücü](https://acrafto.com/tr/unix-zaman-damgasi-donusturucu/) ([Markdown](https://acrafto.com/tr/unix-zaman-damgasi-donusturucu/index.md))
- 日本語 (ja): [UNIXタイムスタンプ変換](https://acrafto.com/ja/unix-timestamp-converter/) ([Markdown](https://acrafto.com/ja/unix-timestamp-converter/index.md))
- 한국어 (ko): [유닉스 타임스탬프 변환기](https://acrafto.com/ko/unix-timestamp-converter/) ([Markdown](https://acrafto.com/ko/unix-timestamp-converter/index.md))
- العربية (ar): [محول Unix Timestamp](https://acrafto.com/ar/unix-timestamp-converter/) ([Markdown](https://acrafto.com/ar/unix-timestamp-converter/index.md))
- हिन्दी (hi): [UNIX टाइमस्टैम्प कनवर्टर](https://acrafto.com/hi/unix-timestamp-converter/) ([Markdown](https://acrafto.com/hi/unix-timestamp-converter/index.md))
- Bahasa Indonesia (id): [Konverter Unix timestamp](https://acrafto.com/id/konverter-timestamp-unix/) ([Markdown](https://acrafto.com/id/konverter-timestamp-unix/index.md))
- Tiếng Việt (vi): [Chuyển đổi Unix timestamp](https://acrafto.com/vi/bo-chuyen-doi-unix-timestamp/) ([Markdown](https://acrafto.com/vi/bo-chuyen-doi-unix-timestamp/index.md))
- ไทย (th): [แปลง Unix Timestamp](https://acrafto.com/th/unix-timestamp-converter/) ([Markdown](https://acrafto.com/th/unix-timestamp-converter/index.md))
- עברית (he): [ממיר Unix Timestamp](https://acrafto.com/he/unix-timestamp-converter/) ([Markdown](https://acrafto.com/he/unix-timestamp-converter/index.md))
