Nodes/JNComfy/Datetime Format
ComfyUI Node

Datetime Format

Turn a DATETIME into a filename-safe string

By jn-jairo·Created 2 years ago·Updated 2 years ago· 5
Datetime Format
  • value
  • STRING
str_format

If you've ever wanted your saved images to carry a real timestamp in the filename instead of ComfyUI's default counter, this is the node that gets you there. It takes a DATETIME value - typically from JN_DatetimeNow - and formats it into a plain STRING you can drop into a filename prefix, a log message, or a Dump node.

Why you'd want it

Batch runs, scheduled jobs, anything you're going to run more than once and need to tell apart later - a timestamp in the output name beats a counter that resets or collides. This node is JNComfy's (jn-jairo/jn_comfyui) bridge from its internal DATETIME type to something every other node in ComfyUI already understands: a string.

How it works

Feed it a value of type DATETIME and a str_format string. This is a Python custom-node pack, and str_format is exactly the kind of parameter name you'd expect on something wrapping Python's own datetime formatting - so treat it as a strftime-style pattern (%Y-%m-%d_%H-%M-%S and friends) rather than free text. The pack's README doesn't spell out the exact format codes it accepts, so if you're not sure a particular code works, the fast way to check is to run it once and read the STRING output back.

The inputs and outputs that matter

  • value (DATETIME) - the timestamp to format. Wire this from JN_DatetimeNow.
  • str_format (STRING, default empty) - your format pattern. An empty string will presumably fall back to whatever the node's default representation is, so don't leave it blank if you actually care about the output format - set it explicitly.

Output is a single STRING - plug it into a Save Image node's filename prefix, a Text Concatenation node to build a longer filename, or a Dump node if you just want to see it.

How to install it

Via ComfyUI Manager: search "JNComfy", install, restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/jn-jairo/jn_comfyui

then restart ComfyUI. This is a small, single-author pack - no meaningful community discussion anywhere we could find, no entry in our knowledge base - so for anything the README doesn't spell out (like the exact format-code support here), testing it directly is faster than searching for it.

Common issues & troubleshooting

Format string doesn't do what you expect. Since the exact formatting behavior isn't documented in the pack's README, don't assume a format code works until you've tested it - run the node once with a simple pattern and check the STRING output before wiring it into a filename you're depending on.

Filename has characters your OS doesn't like. Some strftime-style separators (colons, especially) are fine on Linux but invalid in Windows filenames. If you're formatting a value for use in a Save Image prefix, stick to dashes and underscores between the date/time components rather than colons.

You need the individual components (year, hour, etc.) instead of a formatted string. That's a different node in the same pack - JN_DatetimeInfo breaks a DATETIME down into year/month/day/hour/minute/second/microsecond as separate INT outputs, which is more useful than this node if you're doing math or comparisons rather than building a display string.

CategoryJN/Other

Inputs (2)

NameTypeDefaultDescription
valueDATETIME
str_formatSTRING

Outputs (1)

NameTypeDescription
STRINGSTRING