Nodes/Basic data handling/Unix Timestamp to Time
ComfyUI Node

Unix Timestamp to Time

Stop squinting at 1767225600 — turn Unix timestamps into real times

By StableLlama·Created about a year ago·Updated about 17 hours ago· 48
Unix Timestamp to Time
  • unix_timestamp
  • datetime

If you've ever had a workflow spit out 1767225600 and wondered what on earth that is, this is the node. Unix Timestamp to Time converts a Unix timestamp - the number of seconds since January 1st, 1970 UTC - into a proper DATETIME object ComfyUI can actually use. It's the inverse of the pack's TimeToUnix node, and it exists because a surprising amount of automation out there hands you timestamps instead of dates. File metadata, API responses, model training logs, scheduler states - all of them love speaking in epoch seconds.

It's one node in Basic data handling, a lightweight utility pack by StableLlama (an active r/StableDiffusion regular who describes it as exposing "almost all of the Python API for the basic data types" as nodes). This corner of the pack handles time: TimeNow, TimeToUnix, UnixToTime, plus formatting, parsing, deltas, and component extraction.

How it works

Under the hood it's one line of Python: datetime.datetime.fromtimestamp(unix_timestamp). You feed it a number, you get a datetime back. There's no API call, no timezone database, no model to download - the whole pack has zero dependencies beyond what ComfyUI already ships.

The inputs that matter

The node is about as minimal as nodes get. A single required input:

  • unix_timestamp (FLOAT/INT, default 0) - the seconds-since-epoch value. Default of 0 means the epoch itself, i.e. 1970-01-01, which is a handy sanity check the first time you use it: wire in 0 and confirm you see a 1970 date before trusting anything.

And one output:

  • datetime (DATETIME) - feed it into the pack's TimeFormat node to render it as a readable string, TimeExtract to pull out year/month/day, or TimeDifference to measure a gap against another time.

Where you'd actually use it

The realistic use case is bookkeeping, not image math. Want to stamp a generation with a human-readable timestamp for a filename? Want to compare "when was this file created" against "when was the last run"? Those all start with a Unix timestamp arriving from somewhere, and this node is where it stops being cryptic.

Installing it

# ComfyUI Manager (recommended): search "Basic data handling", install, restart.

# or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/StableLlama/ComfyUI-basic_data_handling
# restart ComfyUI

No requirements.txt, no model files, nothing extra to download. If ComfyUI runs, this pack runs.

Where people get burned

The one real gotcha: the conversion is in your local timezone, not UTC. fromtimestamp() interprets the timestamp in the machine's local time. The pack's own TimeNowUTC node exists precisely because UTC vs local is a thing, but UnixToTime has no UTC toggle - it's always local. So if you're feeding it timestamps from a UTC-based source (most APIs), the wall-clock time it produces will be offset by however far your machine sits from Greenwich. That's usually fine for a filename, and quietly wrong if you're comparing against another UTC-derived value.

Also note the subtle asymmetry in the pack: TimeNow does have a UTC variant, but the timestamp conversion nodes don't. If you need UTC conversion specifically, you'll have to reach for a different tool - this node is local-or-nothing.

CategoryBasic/time

Inputs (1)

NameTypeDefaultDescription
unix_timestampFLOAT,INT0

Outputs (1)

NameTypeDescription
datetimeDATETIME