Nodes/ComfyUI-Xz3r0-Nodes/XDateTimeString
ComfyUI Node

XDateTimeString

Timestamps for every node that forgot to add them

By Xz3r0-M·Created 8 months ago·Updated about 6 hours ago· 13
XDateTimeString
    • datetime_string
    prefix
    format_template%Y%-%m%-%d%_%H%-%M%-%S%
    suffix

    Almost every save node in ComfyUI lets you stick a date in the filename. Almost - and the ones that don't are exactly the ones you end up with when you want a timestamped export. XDateTimeString is the workaround: a tiny node that spits out a formatted date-time string you can feed into any filename, header, or text field. It exists because this pack's own save nodes support datetime tokens natively, but plenty of other nodes don't - and a timestamp string fixes all of them at once.

    How it works

    You give it a prefix (optional), a format_template, and a suffix (optional), and it returns one string: prefix + formatted datetime + suffix. The template uses the pack's own placeholder style, which is worth noting because it's not Python's usual strftime syntax - tokens are wrapped in percent signs, and the percent signs themselves are part of the token:

    • %Y% - four-digit year (2026)
    • %m% - two-digit month (01–12)
    • %d% - two-digit day (01–31)
    • %H% - two-digit hour, 24-hour (00–23)
    • %M% - two-digit minute (00–59)
    • %S% - two-digit second (00–59)

    The default template, %Y%-%m%-%d%_%H%-%M%-%S%, produces something like 2026-08-16_143052. Add a prefix of render_ and a suffix of _v2 and you get render_2026-08-16_143052_v2.

    The neat detail is fingerprint_inputs: it returns the current time, which means ComfyUI never caches this node's result - every execution gets a fresh timestamp. That's the whole point; a cached date-time node would be useless.

    Inputs and output

    • prefix - text before the datetime.
    • format_template - the token template above.
    • suffix - text after the datetime.
    • datetime_string - the only output: your assembled string.

    Installing it

    XDateTimeString is part of ComfyUI-Xz3r0-Nodes. Install the pack once via ComfyUI Manager (search ComfyUI-Xz3r0-Nodes), or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Xz3r0-M/ComfyUI-Xz3r0-Nodes.git
    cd ComfyUI-Xz3r0-Nodes
    pip install -r requirements.txt
    

    Restart ComfyUI. No extra dependencies for this one - it's pure datetime formatting.

    Gotchas

    The biggest trap is the token syntax. If you've internalized strftime from Python or elsewhere, you'll instinctively type %Y-%m-%d and get literally that text with no substitution - this pack wants the trailing % on each token (%Y%), so %Y-%m-%d is missing the closing % on three tokens. Double-check the template if your filenames come out unformatted. Second, the timestamp is generated at node execution, not when you add the node - so if your graph re-executes, the string changes, which is correct for filenames but confusing if you expected a stable value. And keep the pack's filename rule in mind: when you feed this into a save node, the author sanitizes path inputs, so keep your prefixes plain text and let the timestamp be the uniqueness.

    Category♾️ Xz3r0/Workflow-Processing

    Inputs (3)

    NameTypeDefaultDescription
    prefixSTRINGPrefix string, added before datetime
    format_templateSTRING%Y%-%m%-%d%_%H%-%M%-%S%Datetime format template, supports: %Y%(year), %m%(month), %d%(day), %H%(hour), %M%(minute), %S%(second)
    suffixSTRINGSuffix string, added after datetime

    Outputs (1)

    NameTypeDescription
    datetime_stringSTRINGFormatted datetime string