Upload timestamp.html with huggingface_hub
Browse files- timestamp.html +136 -0
timestamp.html
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>time.convert — Unix, ISO 8601, Human readable</title>
|
| 7 |
+
<meta name="description" content="Convert between Unix timestamps, ISO 8601, and human-readable dates instantly. Free, fast, no signup.">
|
| 8 |
+
<style>
|
| 9 |
+
*{margin:0;padding:0;box-sizing:border-box}
|
| 10 |
+
body{background:#0d1117;color:#c9d1d9;font-family:-apple-system,'Segoe UI',monospace;min-height:100vh;padding:3rem 1rem;display:flex;flex-direction:column;align-items:center}
|
| 11 |
+
h1{font-size:2rem;color:#f0f6fc;margin-bottom:.25rem}
|
| 12 |
+
.sub{color:#484f58;margin-bottom:2rem}
|
| 13 |
+
.panel{width:100%;max-width:600px}
|
| 14 |
+
.now{background:#161b22;border:1px solid #30363d;border-radius:8px;padding:1rem;margin-bottom:2rem;text-align:center}
|
| 15 |
+
.now .epoch{color:#58a6ff;font-size:1.5rem;font-family:'Courier New',monospace}
|
| 16 |
+
.now .human{color:#8b949e;font-size:.9rem;margin-top:.35rem}
|
| 17 |
+
label{color:#8b949e;font-size:.85rem;display:block;margin-bottom:.35rem;margin-top:1.25rem}
|
| 18 |
+
input{background:#161b22;border:1px solid #30363d;border-radius:6px;padding:.75rem 1rem;color:#f0f6fc;font-family:'Courier New',monospace;font-size:1rem;outline:none;width:100%}
|
| 19 |
+
input:focus{border-color:#58a6ff}
|
| 20 |
+
.outputs{background:#161b22;border:1px solid #30363d;border-radius:8px;padding:1.25rem;margin-top:1.25rem}
|
| 21 |
+
.row{display:flex;justify-content:space-between;align-items:center;padding:.5rem 0;border-bottom:1px solid #21262d}
|
| 22 |
+
.row:last-child{border-bottom:none}
|
| 23 |
+
.row .label{color:#8b949e;font-size:.85rem}
|
| 24 |
+
.row .value{color:#f0f6fc;font-family:'Courier New',monospace;font-size:.95rem;cursor:pointer;padding:.2rem .4rem;border-radius:3px}
|
| 25 |
+
.row .value:hover{background:#21262d}
|
| 26 |
+
.row .value.copied{color:#3fb950}
|
| 27 |
+
.relative{color:#d2a8ff;margin-top:.75rem;font-size:.9rem;text-align:center}
|
| 28 |
+
.presets{margin-top:1.5rem}
|
| 29 |
+
.presets h3{color:#484f58;font-size:.8rem;text-transform:uppercase;letter-spacing:.1em;margin-bottom:.5rem}
|
| 30 |
+
.pre{display:inline-block;background:#161b22;border:1px solid #21262d;border-radius:4px;padding:.3rem .6rem;margin:.2rem;cursor:pointer;font-size:.8rem;color:#8b949e;font-family:monospace}
|
| 31 |
+
.pre:hover{border-color:#58a6ff;color:#58a6ff}
|
| 32 |
+
.footer{margin-top:3rem;color:#30363d;font-size:.75rem}
|
| 33 |
+
</style>
|
| 34 |
+
</head>
|
| 35 |
+
<body>
|
| 36 |
+
<h1>time.convert</h1>
|
| 37 |
+
<p class="sub">Unix ↔ ISO 8601 ↔ Human readable</p>
|
| 38 |
+
|
| 39 |
+
<div class="panel">
|
| 40 |
+
<div class="now">
|
| 41 |
+
<div class="epoch" id="liveEpoch"></div>
|
| 42 |
+
<div class="human" id="liveHuman"></div>
|
| 43 |
+
</div>
|
| 44 |
+
|
| 45 |
+
<label>Paste a timestamp, date, or ISO string</label>
|
| 46 |
+
<input id="input" type="text" placeholder="1711234567 or 2026-03-23T19:30:00Z or March 23, 2026">
|
| 47 |
+
|
| 48 |
+
<div class="outputs" id="outputs" style="display:none">
|
| 49 |
+
<div class="row"><span class="label">Unix (seconds)</span><span class="value" id="unix" onclick="copy(this)"></span></div>
|
| 50 |
+
<div class="row"><span class="label">Unix (milliseconds)</span><span class="value" id="unixms" onclick="copy(this)"></span></div>
|
| 51 |
+
<div class="row"><span class="label">ISO 8601</span><span class="value" id="iso" onclick="copy(this)"></span></div>
|
| 52 |
+
<div class="row"><span class="label">UTC</span><span class="value" id="utc" onclick="copy(this)"></span></div>
|
| 53 |
+
<div class="row"><span class="label">Local</span><span class="value" id="local" onclick="copy(this)"></span></div>
|
| 54 |
+
<div class="row"><span class="label">Day of week</span><span class="value" id="dow" onclick="copy(this)"></span></div>
|
| 55 |
+
<div class="relative" id="relative"></div>
|
| 56 |
+
</div>
|
| 57 |
+
|
| 58 |
+
<div class="presets">
|
| 59 |
+
<h3>Quick</h3>
|
| 60 |
+
<span class="pre" onclick="setNow()">now</span>
|
| 61 |
+
<span class="pre" onclick="setOffset(-3600)">1 hour ago</span>
|
| 62 |
+
<span class="pre" onclick="setOffset(-86400)">yesterday</span>
|
| 63 |
+
<span class="pre" onclick="setOffset(86400)">tomorrow</span>
|
| 64 |
+
<span class="pre" onclick="setOffset(-604800)">1 week ago</span>
|
| 65 |
+
<span class="pre" onclick="setVal('0')">epoch zero</span>
|
| 66 |
+
<span class="pre" onclick="setVal('2147483647')">Y2K38</span>
|
| 67 |
+
</div>
|
| 68 |
+
</div>
|
| 69 |
+
|
| 70 |
+
<div class="footer">Built by Atreus — dev.tools collection</div>
|
| 71 |
+
|
| 72 |
+
<script>
|
| 73 |
+
function tick() {
|
| 74 |
+
const now = Math.floor(Date.now()/1000);
|
| 75 |
+
document.getElementById('liveEpoch').textContent = now;
|
| 76 |
+
document.getElementById('liveHuman').textContent = new Date().toISOString();
|
| 77 |
+
}
|
| 78 |
+
tick(); setInterval(tick, 1000);
|
| 79 |
+
|
| 80 |
+
const input = document.getElementById('input');
|
| 81 |
+
input.addEventListener('input', convert);
|
| 82 |
+
|
| 83 |
+
function convert() {
|
| 84 |
+
const val = input.value.trim();
|
| 85 |
+
const out = document.getElementById('outputs');
|
| 86 |
+
if (!val) { out.style.display = 'none'; return; }
|
| 87 |
+
|
| 88 |
+
let d = parse(val);
|
| 89 |
+
if (!d || isNaN(d.getTime())) { out.style.display = 'none'; return; }
|
| 90 |
+
|
| 91 |
+
out.style.display = 'block';
|
| 92 |
+
const ts = Math.floor(d.getTime()/1000);
|
| 93 |
+
document.getElementById('unix').textContent = ts;
|
| 94 |
+
document.getElementById('unixms').textContent = d.getTime();
|
| 95 |
+
document.getElementById('iso').textContent = d.toISOString();
|
| 96 |
+
document.getElementById('utc').textContent = d.toUTCString();
|
| 97 |
+
document.getElementById('local').textContent = d.toLocaleString();
|
| 98 |
+
document.getElementById('dow').textContent = d.toLocaleDateString('en-US',{weekday:'long'});
|
| 99 |
+
|
| 100 |
+
const diff = ts - Math.floor(Date.now()/1000);
|
| 101 |
+
const abs = Math.abs(diff);
|
| 102 |
+
let rel;
|
| 103 |
+
if (abs < 60) rel = `${abs} seconds ${diff<0?'ago':'from now'}`;
|
| 104 |
+
else if (abs < 3600) rel = `${Math.floor(abs/60)} minutes ${diff<0?'ago':'from now'}`;
|
| 105 |
+
else if (abs < 86400) rel = `${Math.floor(abs/3600)} hours ${diff<0?'ago':'from now'}`;
|
| 106 |
+
else if (abs < 2592000) rel = `${Math.floor(abs/86400)} days ${diff<0?'ago':'from now'}`;
|
| 107 |
+
else if (abs < 31536000) rel = `${Math.floor(abs/2592000)} months ${diff<0?'ago':'from now'}`;
|
| 108 |
+
else rel = `${(abs/31536000).toFixed(1)} years ${diff<0?'ago':'from now'}`;
|
| 109 |
+
document.getElementById('relative').textContent = rel;
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
function parse(val) {
|
| 113 |
+
// Unix seconds (10 digits)
|
| 114 |
+
if (/^\d{9,10}$/.test(val)) return new Date(parseInt(val)*1000);
|
| 115 |
+
// Unix milliseconds (13 digits)
|
| 116 |
+
if (/^\d{12,13}$/.test(val)) return new Date(parseInt(val));
|
| 117 |
+
// ISO or any string Date can parse
|
| 118 |
+
const d = new Date(val);
|
| 119 |
+
if (!isNaN(d.getTime())) return d;
|
| 120 |
+
return null;
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
function copy(el) {
|
| 124 |
+
navigator.clipboard.writeText(el.textContent);
|
| 125 |
+
el.classList.add('copied');
|
| 126 |
+
const orig = el.textContent;
|
| 127 |
+
el.textContent = 'copied!';
|
| 128 |
+
setTimeout(() => { el.textContent = orig; el.classList.remove('copied'); }, 1000);
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
function setNow() { input.value = Math.floor(Date.now()/1000); convert(); }
|
| 132 |
+
function setOffset(s) { input.value = Math.floor(Date.now()/1000) + s; convert(); }
|
| 133 |
+
function setVal(v) { input.value = v; convert(); }
|
| 134 |
+
</script>
|
| 135 |
+
</body>
|
| 136 |
+
</html>
|