33 lines
776 B
Python
33 lines
776 B
Python
from datetime import datetime
|
|
|
|
|
|
class DatetimeFormatString:
|
|
@classmethod
|
|
def INPUT_TYPES(cls):
|
|
return {
|
|
"required": {
|
|
"text": ("STRING", {
|
|
"default": "output_%Y_%m_%d_%H_%M",
|
|
"multiline": False,
|
|
"tooltip": "Use Python strftime codes: %Y %m %d %H %M %S etc.",
|
|
}),
|
|
}
|
|
}
|
|
|
|
RETURN_TYPES = ("STRING",)
|
|
RETURN_NAMES = ("text",)
|
|
FUNCTION = "format_datetime"
|
|
CATEGORY = "utils"
|
|
|
|
def format_datetime(self, text):
|
|
return (datetime.now().strftime(text),)
|
|
|
|
|
|
NODE_CLASS_MAPPINGS = {
|
|
"DatetimeFormatString": DatetimeFormatString,
|
|
}
|
|
|
|
NODE_DISPLAY_NAME_MAPPINGS = {
|
|
"DatetimeFormatString": "Datetime Format String",
|
|
}
|