ComfyUI > Nodes > Basic data handling > Format Time String

ComfyUI Node: Format Time String

Class Name

Basic data handling: TimeFormat

Category
Basic/time
Author
StableLlama (Account age: 861days)
Extension
Basic data handling
Latest Updated
2026-05-07
Github Stars
0.04K

How to Install Basic data handling

Install this extension via the ComfyUI Manager by searching for Basic data handling
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter Basic data handling in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Format Time String Description

Transforms `DATETIME` objects into customizable, human-readable strings using format codes.

Format Time String:

The "Format Time String" node is designed to transform a DATETIME object into a human-readable string format, using a specified format code. This node is particularly useful for AI artists and developers who need to present date and time information in a specific layout, whether for display purposes, logging, or further processing. By allowing customization of the output format, it provides flexibility in how date and time data is represented, making it adaptable to various regional and contextual requirements. The node leverages standard format codes, such as %Y for year, %m for month, and %d for day, among others, to ensure that users can easily tailor the output to meet their specific needs.

Format Time String Input Parameters:

datetime

The datetime parameter is a DATETIME object that represents the date and time you wish to format. This input is crucial as it serves as the source data that will be transformed into a string. There are no specific minimum or maximum values for this parameter, as it can represent any valid date and time.

format_string

The format_string parameter is a STRING that specifies the desired format for the output string. It uses format codes to define how the date and time should be represented. The default value is "%Y-%m-%d %H:%M:%S", which corresponds to a common format of "year-month-day hour:minute:second". Users can customize this string to match their specific formatting needs, such as "%d/%m/%Y" for a day/month/year format or "%H:%M" for a time-only format.

Format Time String Output Parameters:

formatted_string

The formatted_string is a STRING output that contains the formatted date and time based on the provided format_string. This output is essential for displaying or storing the date and time in a human-readable format that meets specific requirements. The interpretation of this string depends on the format codes used in the format_string, allowing for a wide range of possible representations.

Format Time String Usage Tips:

  • Use the format_string parameter to customize the output format to match regional date and time conventions or specific project requirements.
  • Familiarize yourself with common format codes like %Y, %m, %d, %H, %M, and %S to effectively utilize the node's formatting capabilities.

Format Time String Common Errors and Solutions:

ValueError: time data '...' does not match format '...'

  • Explanation: This error occurs when the datetime object does not match the expected format specified in the format_string.
  • Solution: Ensure that the datetime object is correctly initialized and that the format_string accurately reflects the desired output format. Double-check the format codes used in the format_string for accuracy.

Format Time String Related Nodes

Go back to the extension to check out more related nodes.
Basic data handling
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Models, enabling artists to harness the latest AI tools to create incredible art.

Format Time String