Nodes/ComfyUI-HeresyNodes/⛧Get Date Time String (Updatable)
ComfyUI Node

⛧Get Date Time String (Updatable)

A timestamp that actually refreshes every run, for filenames that never collide

By heresyCoder·Created 3 months ago·Updated 3 months ago· 2
⛧Get Date Time String (Updatable)
    • time_format
    updatetrue
    style

    The "Updatable" in the name is doing real work, and it's the reason this node exists. ComfyUI caches aggressively: a plain node that computes datetime.now() runs once, and every subsequent run of the same graph gets the same cached string back. Get Date Time String (Updatable) exists specifically to opt out of that caching, so the timestamp you read is the moment you queued, not the moment you first loaded the workflow.

    You reach for it when you want output filenames that never collide. ComfyUI's built-in SaveImage has its own %date% token, but it's a fixed format and it's baked into the save node. This node hands you a plain string you can feed into any filename_prefix input - or combine with other strings - in whatever strftime format you like.

    The two inputs

    • style - a dropdown of 13 strftime formats: %Y%m%d%H%M%S, %Y-%m-%d-%H_%M_%S, %Y%m%d, %H%M%S, and variants with _ separators. Pick the granularity you need. %Y%m%d%H%M%S (year-month-day-hour-minute-second) is the one that makes filenames unique per run; drop down to %Y%m%d if you only want per-day folders.
    • update - the toggle that decides whether it refreshes. true (the default) re-computes the timestamp on every execution. Set it to false and you get a fixed snapshot you can treat as a constant for the rest of the run.

    Output is a single time_format string, ready to wire into anything that accepts a prefix or path.

    How the trick works

    This is a clean demonstration of ComfyUI's IS_CHANGED mechanism. Normally a node only re-executes when one of its inputs changes. This node defines IS_CHANGED to return the current timestamp when update is true - and since the timestamp is different every time, ComfyUI decides the node has changed and re-runs it on every queue. Same idea as the always-dirty "NaN" idiom used by random pickers and clocks, just implemented as an actual changing value. Leave update off and it returns a stable value, so the cache works normally again. The plumbing lesson, if you're curious: any node that returns a changing value from IS_CHANGED forces itself - and everything upstream - to re-execute each run, so don't be surprised if your whole graph feels a touch less cached while it's live.

    Installing and using it

    The node lives in ComfyUI-HeresyNodes, a small personal pack by heresyCoder built for Wan video loop workflows. Install it once and it's available to every node in this pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/heresyCoder/ComfyUI-HeresyNodes
    

    Restart after cloning, or use ComfyUI Manager (search "ComfyUI-HeresyNodes"). No models, no extra pip packages.

    A natural setup: wire time_format into the filename_prefix of Save Image Batch (For Loops) from the same pack, or into any SaveImage prefix. Since loop iterations reuse the same graph, a second run produces a fresh timestamp and a brand-new set of files instead of overwriting - which is exactly the collision the pack's save nodes assume you want.

    One honest caveat: this is a utility, not magic. It gives you a timestamp string, and it re-runs when you tell it to. If that sounds thin, it is - but for loop pipelines that save dozens of numbered files per run, a per-run timestamp prefix is the difference between "which output was this?" and knowing instantly.

    Category⛧Heresy Nodes/utils

    Inputs (2)

    NameTypeDefaultDescription
    updateBOOLEANtrueUpdate every run
    styleCOMBO13 options: %Y%m%d%H%M%S, %Y%m%d%H%M, %Y%m%d, %Y-%m-%d-%H_%M_%S, %Y-%m-%d-%H_%M, %Y-%m-%d, +7

    Outputs (1)

    NameTypeDescription
    time_formatSTRING