Extract Time Components
Eight Time Components From One DATETIME, All at Once
- datetime
- year
- month
- day
- hour
- minute
- second
- microsecond
- weekday
Sometimes you don't want a formatted date string - you want the parts. Extract Time Components takes a DATETIME and splits it into eight separate integer outputs: year, month, day, hour, minute, second, microsecond, and weekday. If you've ever needed "only the month" or "what day of the week is this," this node hands you each piece on its own wire.
How it works
From StableLlama's Basic data handling pack. One required input: datetime (a DATETIME, from TimeNow, TimeNowUTC, or TimeParse). And it fans out to eight outputs, all INT:
year,month,day,hour,minute,second,microsecond- the obvious calendar/time parts.weekday- with a specific convention: Monday is 0, Sunday is 6. That's Python'sdatetime.weekday(), not the ISO standard (where Monday is 1). It's an easy thing to get backwards.
The node simply unwraps the DATETIME's fields, so no formatting codes, no configuration, nothing to set wrong. Feed it a value, get eight wires back.
Where it fits
- Month-based filenames - build
2026-08by takingyearandmonthand formatting them yourself. - Day-of-week logic - "run this only on weekdays" becomes: extract
weekday, compare it against 5 (Saturday) or 6 (Sunday). - Conditional scheduling - "if hour is between X and Y" needs
houras a number, and this node gives you exactly that. - Microsecond uniqueness - for near-collision-proof naming,
microsecondis the highest-resolution component this pack exposes.
Each output is a plain INT, so unlike the DATETIME itself, these plug into any node that takes an integer - comparisons, math, filename builders, you name it. That's the quiet superpower here: after extraction, you're back in the land of normal ComfyUI types.
Installing it
Search "Basic data handling" in ComfyUI Manager and restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/StableLlama/ComfyUI-basic_data_handling
Restart and it's live. No dependencies, no models.
Gotchas
The weekday convention is the trap. Monday = 0 means 5 is Saturday and 6 is Sunday - if your mental model is ISO (Monday = 1, Sunday = 7), every weekday check you write will be off by one. Write a comment on your graph or just double-check with a known date before building logic on it. Also, you don't have to use all eight outputs - ComfyUI is fine with you only wiring the two or three you care about.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| datetime | DATETIME | — |
Outputs (8)
| Name | Type | Description |
|---|---|---|
| year | INT | — |
| month | INT | — |
| day | INT | — |
| hour | INT | — |
| minute | INT | — |
| second | INT | — |
| microsecond | INT | — |
| weekday | INT | — |