Padding digits with converted dates

i want to convert dates from format M/D/YYYY to YYYY-MM-DD:
ex. 11/7/2017 to 2017-11-07

$regexp(%releasetime%,(\d+)/(\d+)/(\d+),$3-$1-$2)

the problem is that if the original date contains a single digit for month or day, i get a single digit in the converted date. (ex. 11/7/2017 becomes 2017-11-7 not 2017-11-07)

how do i pad the month and day to always display 2 digits?

i tried: $regexp(%releasetime%,(\d+)/(\d+)/(\d+),$3-$1-$num($2,2))

but this does not work, returns: 2017-11-00

any help with this would be appreciated, thanks.

You could run a second action in that action group with this expression:
$regexp(%releasetime%,(\d+)-(\d)$,$1-0$2)
It leaves '2017-11-07' as it is but transforms
'2017-11-7' into '2017-11-07'

Read there ...
/t/9074/1

DD.20171108.0800.CET