Turns out you can use formulas.
@concat(
'P',
'6D',
'T',
sub(23, int(formatDateTime(utcNow(), 'HH'))),
'H',
sub(59, int(formatDateTime(utcNow(), 'mm'))),
'M',
sub(59, int(formatDateTime(utcNow(), 'ss'))),
'S'
)
this will generate
if the time is 2022-03-24T20:04:10
this code will generate P6DT3H55M49S
Wich represents the time until midnight 6 days from now
Note that the code was prettified for readability it would actually be like this.
@concat('P', '6D', 'T', sub(23, int(formatDateTime(utcNow(), 'HH'))), 'H', sub(59, int(formatDateTime(utcNow(), 'mm'))), 'M', sub(59, int(formatDateTime(utcNow(), 'ss'))), 'S')
Good luck.