diff --git a/.github/workflows/lighthouse.yml b/.github/workflows/lighthouse.yml
index b0df957..e009de6 100644
--- a/.github/workflows/lighthouse.yml
+++ b/.github/workflows/lighthouse.yml
@@ -30,6 +30,9 @@ jobs:
- name: Test JSON and YAML comparison
run: node --test scripts/json-diff.test.cjs
+ - name: Test timestamp parsing and comparison
+ run: node --test scripts/timestamp-converter.test.cjs
+
- name: Validate HTML
uses: Cyb3r-Jak3/html5validator-action@v7.2.0
with:
@@ -56,6 +59,7 @@ jobs:
yaml-formatter/index.html
json-diff/index.html
crontab/index.html
+ timestamp-converter/index.html
terraform-modules/index.html
fail: true
jobSummary: true
@@ -82,4 +86,5 @@ jobs:
http://127.0.0.1:8080/yaml-formatter/
http://127.0.0.1:8080/json-diff/
http://127.0.0.1:8080/crontab/
+ http://127.0.0.1:8080/timestamp-converter/
http://127.0.0.1:8080/terraform-modules/
diff --git a/README.md b/README.md
index ec3d2a0..7a55f4f 100644
--- a/README.md
+++ b/README.md
@@ -199,6 +199,29 @@ section navigation, and connected page/application/author/image structured data.
links. Follow the crontab checks in [`SEARCH_CONSOLE.md`](./SEARCH_CONSOLE.md)
after deployment to inspect indexing and measure actual search performance.
+## Unix Timestamp Converter
+
+Open `/timestamp-converter/` to convert between Unix seconds, Unix
+milliseconds, and ISO 8601. See each instant in UTC and a searchable display
+time zone. Enter a second timestamp to see the event order, exact elapsed time,
+and copyable AWS CloudWatch Logs `--start-time` and `--end-time` flags.
+
+Auto-detect treats numbers with 12 or more digits before the decimal as
+milliseconds and shorter numbers as seconds. Choose a unit explicitly for
+ambiguous values. ISO dates default to midnight UTC. Date and time inputs
+accept `Z`, `UTC`, or a numeric offset, including values copied as JSON strings.
+Fractional values retain up to nanosecond precision.
+CloudWatch ranges widen to whole milliseconds when needed and start at the Unix
+epoch or later. The browser processes all inputs locally.
+
+The conversion engine lives in `timestamp-converter/timestamp.js`. The page
+shares the Cron Schedule Builder’s theme and time-zone picker. Run the
+conversion and comparison tests with Node.js 22 or later:
+
+```sh
+node --test scripts/timestamp-converter.test.cjs
+```
+
## Terraform Modules
Open `/terraform-modules/` to explore public AWS Terraform modules
@@ -280,6 +303,7 @@ python3 -m http.server 8080
- `http://localhost:8080/yaml-formatter/`
- `http://localhost:8080/json-diff/`
- `http://localhost:8080/crontab/`
+- `http://localhost:8080/timestamp-converter/`
- `http://localhost:8080/terraform-modules/`
## Quality and search checks
diff --git a/SEARCH_CONSOLE.md b/SEARCH_CONSOLE.md
index ca1ec71..7fbf532 100644
--- a/SEARCH_CONSOLE.md
+++ b/SEARCH_CONSOLE.md
@@ -39,6 +39,7 @@ invented or replaced with a placeholder.
- `https://native-cube.com/yaml-formatter/`
- `https://native-cube.com/json-diff/`
- `https://native-cube.com/crontab/`
+ - `https://native-cube.com/timestamp-converter/`
- `https://native-cube.com/terraform-modules/`
4. Do not submit `/json-formatter/`; it is a redirect alias.
diff --git a/assets/time-zone-picker.js b/assets/time-zone-picker.js
new file mode 100644
index 0000000..eea3b6b
--- /dev/null
+++ b/assets/time-zone-picker.js
@@ -0,0 +1,137 @@
+"use strict";
+
+function setupTimeZonePicker(timeZone, { onInput, onSelect }) {
+ const picker = timeZone.closest(".timezone-picker");
+ const toggle = picker.querySelector("button");
+ const list = document.getElementById(timeZone.getAttribute("aria-controls"));
+ const matches = picker.querySelector("[role=status]");
+ const commonZones = ["UTC", "Europe/London", "Europe/Warsaw", "America/New_York", "America/Los_Angeles", "Asia/Kolkata", "Asia/Tokyo", "Australia/Sydney"];
+ let availableZones = [];
+ try {
+ availableZones = typeof Intl.supportedValuesOf === "function" ? Intl.supportedValuesOf("timeZone") : [];
+ } catch { /* Common choices and manual input remain available. */ }
+ const zones = [...new Set([...commonZones, ...availableZones])];
+ let filteredZones = [];
+ let activeIndex = -1;
+
+ function close() {
+ list.hidden = true;
+ timeZone.setAttribute("aria-expanded", "false");
+ timeZone.removeAttribute("aria-activedescendant");
+ toggle.setAttribute("aria-expanded", "false");
+ toggle.setAttribute("aria-label", "Show time zones");
+ matches.textContent = "";
+ activeIndex = -1;
+ }
+
+ function open(query = "") {
+ const tokens = query.trim().toLowerCase().replaceAll("_", " ").split(/[\s/]+/).filter(Boolean);
+ filteredZones = zones.filter((zone) => tokens.every((token) => zone.toLowerCase().replaceAll("_", " ").includes(token)));
+ activeIndex = -1;
+ timeZone.removeAttribute("aria-activedescendant");
+ const fragment = document.createDocumentFragment();
+ filteredZones.forEach((zone, index) => {
+ const option = document.createElement("li");
+ option.id = `${list.id}-${index}`;
+ option.className = "timezone-option";
+ option.dataset.zone = zone;
+ option.dataset.index = index;
+ option.setAttribute("role", "option");
+ option.setAttribute("aria-selected", String(zone === timeZone.value.trim()));
+ option.textContent = zone;
+ fragment.append(option);
+ });
+ if (!filteredZones.length) {
+ const empty = document.createElement("li");
+ empty.className = "timezone-empty";
+ empty.setAttribute("role", "option");
+ empty.setAttribute("aria-disabled", "true");
+ empty.textContent = "No matching suggestions. You can still type a full IANA time zone.";
+ fragment.append(empty);
+ }
+ list.replaceChildren(fragment);
+ list.hidden = false;
+ list.scrollTop = 0;
+ timeZone.setAttribute("aria-expanded", "true");
+ toggle.setAttribute("aria-expanded", "true");
+ toggle.setAttribute("aria-label", "Hide time zones");
+ matches.textContent = filteredZones.length ? `${filteredZones.length} time zone${filteredZones.length === 1 ? "" : "s"} available.` : "No matching suggestions. Manual entry is still available.";
+ }
+
+ function activate(index, scroll = true) {
+ if (!filteredZones.length) return;
+ activeIndex = Math.max(0, Math.min(index, filteredZones.length - 1));
+ [...list.children].forEach((option, position) => {
+ option.classList.toggle("is-active", position === activeIndex);
+ option.setAttribute("aria-selected", String(position === activeIndex));
+ });
+ const option = list.children[activeIndex];
+ timeZone.setAttribute("aria-activedescendant", option.id);
+ if (scroll) option.scrollIntoView({ block: "nearest", behavior: "instant" });
+ }
+
+ function choose(zone) {
+ timeZone.value = zone;
+ timeZone.focus({ preventScroll: true });
+ timeZone.setSelectionRange(zone.length, zone.length);
+ close();
+ onSelect();
+ }
+
+ function resumeEditing() {
+ activeIndex = -1;
+ timeZone.removeAttribute("aria-activedescendant");
+ [...list.children].forEach((option) => {
+ option.classList.remove("is-active");
+ option.setAttribute("aria-selected", String(option.dataset.zone === timeZone.value.trim()));
+ });
+ }
+
+ timeZone.addEventListener("focus", () => open());
+ timeZone.addEventListener("click", () => {
+ if (list.hidden) open();
+ else resumeEditing();
+ });
+ timeZone.addEventListener("input", () => {
+ open(timeZone.value);
+ onInput();
+ });
+ timeZone.addEventListener("keydown", (event) => {
+ if (event.isComposing) return;
+ if (event.key === "ArrowDown" || event.key === "ArrowUp") {
+ event.preventDefault();
+ if (event.altKey && event.key === "ArrowUp") { close(); return; }
+ if (list.hidden) open();
+ if (!event.altKey) activate(activeIndex < 0 ? event.key === "ArrowDown" ? 0 : filteredZones.length - 1 : activeIndex + (event.key === "ArrowDown" ? 1 : -1));
+ } else if (event.key === "Enter" && !list.hidden) {
+ if (activeIndex >= 0) {
+ event.preventDefault();
+ choose(filteredZones[activeIndex]);
+ } else close();
+ } else if (event.key === "Escape" && !list.hidden) {
+ event.preventDefault();
+ close();
+ } else if (event.key === "Tab") close();
+ else if (["ArrowLeft", "ArrowRight", "Home", "End"].includes(event.key)) resumeEditing();
+ });
+ toggle.addEventListener("mousedown", (event) => event.preventDefault());
+ toggle.addEventListener("click", () => {
+ const wasOpen = !list.hidden;
+ timeZone.focus({ preventScroll: true });
+ if (wasOpen) close();
+ else open();
+ });
+ list.addEventListener("mousedown", (event) => event.preventDefault());
+ list.addEventListener("pointermove", (event) => {
+ const option = event.target.closest("[data-zone]");
+ if (option && Number(option.dataset.index) !== activeIndex) activate(Number(option.dataset.index), false);
+ });
+ list.addEventListener("click", (event) => {
+ const option = event.target.closest("[data-zone]");
+ if (option) choose(option.dataset.zone);
+ });
+ document.addEventListener("pointerdown", (event) => { if (!picker.contains(event.target)) close(); });
+ document.addEventListener("focusin", (event) => { if (!picker.contains(event.target)) close(); });
+ window.addEventListener("blur", close);
+ return close;
+}
diff --git a/crontab/app.js b/crontab/app.js
index 28a71f1..4450312 100644
--- a/crontab/app.js
+++ b/crontab/app.js
@@ -32,143 +32,7 @@
let current = null;
let renderTimer;
let toastTimer;
- const closeTimeZones = setupTimeZonePicker();
-
- function setupTimeZonePicker() {
- const picker = byId("timezone-picker");
- const toggle = byId("timezone-toggle");
- const list = byId("timezone-options");
- const matches = byId("timezone-status");
- const commonZones = ["UTC", "Europe/London", "Europe/Warsaw", "America/New_York", "America/Los_Angeles", "Asia/Kolkata", "Asia/Tokyo", "Australia/Sydney"];
- let availableZones = [];
- try {
- availableZones = typeof Intl.supportedValuesOf === "function" ? Intl.supportedValuesOf("timeZone") : [];
- } catch { /* Common choices and manual input remain available. */ }
- const zones = [...new Set([...commonZones, ...availableZones])];
- let filteredZones = [];
- let activeIndex = -1;
-
- function close() {
- list.hidden = true;
- timeZone.setAttribute("aria-expanded", "false");
- timeZone.removeAttribute("aria-activedescendant");
- toggle.setAttribute("aria-expanded", "false");
- toggle.setAttribute("aria-label", "Show time zones");
- matches.textContent = "";
- activeIndex = -1;
- }
-
- function open(query = "") {
- const tokens = query.trim().toLowerCase().replaceAll("_", " ").split(/[\s/]+/).filter(Boolean);
- filteredZones = zones.filter((zone) => tokens.every((token) => zone.toLowerCase().replaceAll("_", " ").includes(token)));
- activeIndex = -1;
- timeZone.removeAttribute("aria-activedescendant");
- const fragment = document.createDocumentFragment();
- filteredZones.forEach((zone, index) => {
- const option = document.createElement("li");
- option.id = `timezone-option-${index}`;
- option.className = "timezone-option";
- option.dataset.zone = zone;
- option.dataset.index = index;
- option.setAttribute("role", "option");
- option.setAttribute("aria-selected", String(zone === timeZone.value.trim()));
- option.textContent = zone;
- fragment.append(option);
- });
- if (!filteredZones.length) {
- const empty = document.createElement("li");
- empty.className = "timezone-empty";
- empty.setAttribute("role", "option");
- empty.setAttribute("aria-disabled", "true");
- empty.textContent = "No matching suggestions. You can still type a full IANA time zone.";
- fragment.append(empty);
- }
- list.replaceChildren(fragment);
- list.hidden = false;
- list.scrollTop = 0;
- timeZone.setAttribute("aria-expanded", "true");
- toggle.setAttribute("aria-expanded", "true");
- toggle.setAttribute("aria-label", "Hide time zones");
- matches.textContent = filteredZones.length ? `${filteredZones.length} time zone${filteredZones.length === 1 ? "" : "s"} available.` : "No matching suggestions. Manual entry is still available.";
- }
-
- function activate(index, scroll = true) {
- if (!filteredZones.length) return;
- activeIndex = Math.max(0, Math.min(index, filteredZones.length - 1));
- [...list.children].forEach((option, position) => {
- option.classList.toggle("is-active", position === activeIndex);
- option.setAttribute("aria-selected", String(position === activeIndex));
- });
- const option = list.children[activeIndex];
- timeZone.setAttribute("aria-activedescendant", option.id);
- if (scroll) option.scrollIntoView({ block: "nearest", behavior: "instant" });
- }
-
- function choose(zone) {
- timeZone.value = zone;
- timeZone.focus({ preventScroll: true });
- timeZone.setSelectionRange(zone.length, zone.length);
- close();
- render();
- }
-
- function resumeEditing() {
- activeIndex = -1;
- timeZone.removeAttribute("aria-activedescendant");
- [...list.children].forEach((option) => {
- option.classList.remove("is-active");
- option.setAttribute("aria-selected", String(option.dataset.zone === timeZone.value.trim()));
- });
- }
-
- timeZone.addEventListener("focus", () => open());
- timeZone.addEventListener("click", () => {
- if (list.hidden) open();
- else resumeEditing();
- });
- timeZone.addEventListener("input", () => {
- open(timeZone.value);
- queueRender();
- });
- timeZone.addEventListener("keydown", (event) => {
- if (event.isComposing) return;
- if (event.key === "ArrowDown" || event.key === "ArrowUp") {
- event.preventDefault();
- if (event.altKey && event.key === "ArrowUp") { close(); return; }
- if (list.hidden) open();
- if (!event.altKey) activate(activeIndex < 0 ? event.key === "ArrowDown" ? 0 : filteredZones.length - 1 : activeIndex + (event.key === "ArrowDown" ? 1 : -1));
- } else if (event.key === "Enter" && !list.hidden) {
- if (activeIndex >= 0) {
- event.preventDefault();
- choose(filteredZones[activeIndex]);
- } else close();
- } else if (event.key === "Escape" && !list.hidden) {
- event.preventDefault();
- close();
- } else if (event.key === "Tab") close();
- else if (["ArrowLeft", "ArrowRight", "Home", "End"].includes(event.key)) resumeEditing();
- });
- toggle.addEventListener("mousedown", (event) => event.preventDefault());
- toggle.addEventListener("click", () => {
- const wasOpen = !list.hidden;
- timeZone.focus({ preventScroll: true });
- if (wasOpen) close();
- else open();
- });
- list.addEventListener("mousedown", (event) => event.preventDefault());
- list.addEventListener("pointermove", (event) => {
- const option = event.target.closest("[data-zone]");
- if (option && Number(option.dataset.index) !== activeIndex) activate(Number(option.dataset.index), false);
- });
- list.addEventListener("click", (event) => {
- const option = event.target.closest("[data-zone]");
- if (option) choose(option.dataset.zone);
- });
- document.addEventListener("pointerdown", (event) => { if (!picker.contains(event.target)) close(); });
- document.addEventListener("focusin", (event) => { if (!picker.contains(event.target)) close(); });
- window.addEventListener("blur", close);
- return close;
- }
+ const closeTimeZones = setupTimeZonePicker(timeZone, { onInput: queueRender, onSelect: render });
function notify(message) {
clearTimeout(toastTimer);
diff --git a/crontab/index.html b/crontab/index.html
index 3d06cdd..eaa9e12 100644
--- a/crontab/index.html
+++ b/crontab/index.html
@@ -64,7 +64,8 @@
Crontab Generator & Cron Expression Tester | Native Cube
-
+
+
+
+
+
+
+
+ Skip to timestamp input
+
+
+
+
+
+
+
+ Unix TimestampConverter
+
+ Convert epoch seconds, milliseconds, and ISO 8601 dates. Compare timestamps from logs
+ and APIs in UTC and your chosen time zone.
+
+
+
+
+ Converter
+ Examples
+ Input formats
+
+
+ Enable JavaScript to convert timestamps. The examples and format reference are available below.
+
+
+
+
+
Timestamp examples
+
Load an example into the converter to see how it interprets the input.
+
+
+
+ Epoch milliseconds
+ 1735732800250
+ 1 January 2025 at 12:00:00.250 UTC.
+
+
+ Deploy to first error
+ 2025-01-01T12:00:00.250Z
+ 1735732930500
+ The first error arrived 2 min 10.25 s after the deploy.
+
+
+ A repeated local hour
+ 2025-11-02T01:30:00-04:00
+ 2025-11-02T01:30:00-05:00
+ In New York, these two 01:30 timestamps are an hour apart.
+
+
+
+
+
+
+
+
Conversions, comparisons, and clipboard output are generated on this device. Inputs stay in this browser tab.
+
+
+
+ Unix seconds and milliseconds
+ Unix time counts from 1 January 1970 at 00:00:00 UTC. Negative values describe earlier instants. One second is 1,000 milliseconds.
+ Auto-detect reads numbers with 12 or more digits before the decimal as milliseconds, ignoring the sign and leading zeros. Choose a unit explicitly for ambiguous inputs, such as 1000 milliseconds.
+
+
+ ISO 8601 and time zones
+ Use Z, UTC, or an offset such as +05:30 with a date and time. A date alone is midnight UTC. Use seconds 00–59 and up to nine fractional digits.
+ Paste a single timestamp value from JSON or logs. Quoted JSON strings are accepted.
+ The display time zone uses the browser’s historical offset for the instant. Fractional seconds stay exact when converting or comparing.
+
+
+ CloudWatch Logs bounds
+ The converter sorts two instants and writes --start-time and --end-time in Unix milliseconds. For sub-millisecond inputs, it rounds the start down and the end up.
+ Log ranges start at the Unix epoch or later. Add the copied flags to aws logs filter-log-events with your log group.
+ Read the AWS CLI reference ↗
+
+
+
+
+
+
+
+
+
+
+
+