{ this.now = Math.floor(Date.now() / 1000); }, 1000); },
copyNow() { navigator.clipboard.writeText(String(this.now)); this.copiedNow = true; setTimeout(() => this.copiedNow = false, 1500); },
useNow() { this.ts = String(this.now); this.mode = 'toHuman'; },
get human() {
if (this.mode !== 'toHuman' || !this.ts.trim()) return null;
const raw = this.ts.trim();
const n = parseInt(raw, 10);
if (isNaN(n)) return { error: this.invalidMsg };
const ms = raw.length <= 10 ? n * 1000 : n;
const d = new Date(ms);
if (isNaN(d.getTime())) return { error: this.invalidMsg };
return {
local: d.toLocaleString(),
utc: d.toUTCString(),
iso: d.toISOString(),
unix_s: Math.floor(ms / 1000),
unix_ms: ms
};
},
get toUnixResult() {
if (this.mode !== 'toUnix' || !this.dt) return null;
const d = new Date(this.dt);
if (isNaN(d.getTime())) return null;
return { unix_s: Math.floor(d.getTime() / 1000), unix_ms: d.getTime() };
}
}">
Timestamp-Konverter
Unix-Timestamp in lesbares Datum (lokal, UTC, ISO 8601) umwandeln oder umgekehrt.
Jetzt (Unix):
Lokal
UTC
ISO 8601
Unix (s)
Unix (ms)
Unix (s)
Unix (ms)