Date-Time

This function block provides the current date and time as a human-readable string. You can choose between several common formats and a filename-friendly variant for saving files.

πŸ“₯ Inputs

This function block does not have any inputs.

πŸ“€ Outputs

Text The current date and time as a string, formatted according to the selected options.

πŸ•ΉοΈ Controls

Format Combobox to select output format. Typical choices include:

  • Standard (YYYY-MM-DD HH:MM:SS)

  • Milliseconds (YYYY-MM-DD HH:MM:SS.sss)

  • Iso Format (ISO 8601)

File Name Mode Combobox to select a filename-friendly style. Options include:

  • Standard (human-readable string)

  • File Name (replaces characters like ":" and spaces so the string can be used as a file or folder name)

🎨 Features

  • Multiple date/time formats for different needs (readable text, high-precision timestamps, or ISO standard).

  • Filename-safe option that transforms the date/time into a format suitable for file naming without additional processing.

  • Simple, no-input operation β€” returns the current system time on each evaluation.

πŸ“ Usage Instructions

  1. Choose the desired output style with the Format control.

  2. If you plan to use the output as part of a filename (for saving images, logs, or videos), select the File Name Mode to get a safe string.

  3. Connect the Text output to downstream blocks that need time information (for naming files, logging, or annotations).

πŸ“Š Evaluation

Each run, this function block reads the system clock and outputs a string formatted according to the chosen Format and File Name Mode settings.

πŸ’‘ Tips and Tricks

  • Use the block together with Image Write or Image Logger to save images with a timestamped filename. Selecting File Name mode will avoid illegal filename characters automatically.

  • Combine with Record Video when creating time-stamped recordings to organize files by run time.

  • Pair with CSV Export or Data to JSON to add a readable timestamp to exported data rows or logs.

  • If you need separate date/time components (year, month, hour, etc.) for conditional logic or display, consider using Date-Time List where available to get structured elements instead of a single string.

  • Use String Merge to combine the timestamp with other text (for example, camera ID or experiment name) before writing files with File/Folder Operations or Choose Folder.

πŸ› οΈ Troubleshooting

  • If filenames created using the timestamp cause errors on save, switch the File Name Mode to File Name to remove or replace characters that are not permitted in filenames.

  • If you need higher precision for short-duration events, select the Milliseconds format.

  • If downstream blocks expect a specific timestamp format, verify the chosen Format matches that expectation and adjust accordingly.

Last updated

Was this helpful?