I’d like to create a script, that would copy current date and time in the format 2024-07-26-2335.

2024-07-26-2343

Well, it works!

The code for sway config is:

bindsym --to-code $mod+$alt+v exec sh -c 'date "+%Y-%m-%d-%H%M" | wl-copy && sleep 0.1 && wtype -P XF86Paste'

And if it was a script to perform, that would be:

date "+%Y-%m-%d-%H%M" | wl-copy