ComfyUI Node

Get Timestamp

Stamp your output filenames without leaving the graph

By huyl3-cpu·Created 9 months ago·Updated 4 months ago· 1
Get Timestamp
    • timestamp
    formatYYYY-MM-DD_HH-MM-SS
    prefix
    custom_format%Y-%m-%d_%H-%M-%S

    A small, useful utility: it generates the current time as a formatted string, which you can then feed into filenames, folder names, or logging so your automated pipeline doesn't overwrite yesterday's run.

    Why you'd want this

    ComfyUI's built-in save nodes support some date tokens in their filename prefix field, but they're limited. If you're building an automated pipeline - batch renders, scheduled jobs, anything that runs unattended more than once - you generally want more control over exactly how that timestamp looks, and you often want it as a standalone value you can route to more than one place (a folder name and a log entry and a filename, say). This node gives you that as a plain string you can wire anywhere.

    How it works

    Pick a format from the preset list, and it returns the current time formatted that way. If none of the presets fit, set format to custom and it'll use whatever pattern you put in custom_format instead - standard Python strftime tokens (the default there is %Y-%m-%d_%H-%M-%S).

    Inputs and outputs

    • format (enum, default YYYY-MM-DD_HH-MM-SS) - the preset. Other choices: YYYYMMDD_HHMMSS, YYYY-MM-DD, HH-MM-SS, or custom.
    • prefix (STRING, optional, default "") - text prepended to the timestamp.
    • custom_format (STRING, optional, default "%Y-%m-%d_%H-%M-%S") - only used when format is set to custom.
    • Output: timestamp (STRING) - wire it into a save node's prefix, a folder-name field, or concatenate it into a full path.

    Installing it

    No models or extra dependencies documented - it's plain Python datetime formatting. Search ComfyUI Manager for the repo name first; this is a small personal pack, so a manual install is the reliable fallback:

    cd ComfyUI/custom_nodes
    git clone https://github.com/huyl3-cpu/comfyui-sortlist.git
    

    Restart ComfyUI afterward.

    Common issues and troubleshooting

    Setting custom_format does nothing unless format is actually set to custom. This trips people up because both fields are visible on the node at once - but custom_format is only read when the format enum is literally on its custom option. If you've typed a custom pattern and you're still getting the default preset back, check that dropdown first.

    It only produces a string - it doesn't build a full path for you. If you're chaining this into one of this pack's filesystem nodes (move_file, Clear-Folder-By-Pattern), you still need a separate step to concatenate the timestamp into an actual filename or path. prefix covers the simple case (prepending fixed text to the stamp), but anything more structured needs a string-concatenation node in between.

    Double-check your custom_format tokens if you go that route. It's raw strftime syntax, so a typo (%y instead of %Y, for instance) won't error - it'll just silently produce a different, probably wrong, timestamp. Preview the output once before trusting it in an automated run.

    Categorycomfyui-sortlist

    Inputs (3)

    NameTypeDefaultDescription
    formatCOMBOYYYY-MM-DD_HH-MM-SS5 options: YYYY-MM-DD_HH-MM-SS, YYYYMMDD_HHMMSS, YYYY-MM-DD, HH-MM-SS, custom
    prefixoptSTRING
    custom_formatoptSTRING%Y-%m-%d_%H-%M-%S

    Outputs (1)

    NameTypeDescription
    timestampSTRING