Well, this might give some clue:
https://forum.bytesforall.com/showthread.php?t=1065
Without any context, it’s hard for me to imagine what’s going on, but as far as I can see, the regex just strips off the ‘%’ signs so you’re left with a call to the original function.
Perhaps you could post something like half a dozen lines around the code you’re quoting so I can get a better idea of what’s happening?
Either that or just replace the whole of the code with the appropriate PHP and WP date and time functions (all of which I referred to in previous posts). WP functions to get the dates and times: PHP functions to do the Maths. I think you’ve already said that PHP isn’t a problem for you.
I hope you’re doing this in a child theme BTW. Messing with the theme code itself is probably not such a good idea, especially when child themes are so easy. Assuming the theme is child theme friendly, of course. If not, you probably need to copy the whole theme, rename it, activate it and work on the renamed theme: but you’ll miss out on updates and bug fixes, of course, if you don’t use a child theme.
Anyway, it doesn’t sound to me as though what you want to do is so hard. You’re just wanting to conditionally output some text, after all.
HTH
PAE