Hi RobertJ,
The regex picks those two digits because they're the only ones preceded by a space.
As for the rest: because the /e modifier is used on the substitution, the replacement part is evaluated as a Perl expression. sprintf is documented in sprintf: the first argument is the format specifier, in this case %i, aka %d: "a signed integer, in decimal", where 2.2 specifies a minimum width of 2 and a precision of 2 (personally, I would have written it as %02d, TIMTOWTDI). As for the argument to be formatted, $1 refers to the first capture group of the regex, in this case the two digits of the hour, from which 1 hour is subtracted. The formatted string returned by sprintf is then used as the substitution.
Hope this helps,
-- Hauke D
In reply to Re^5: Date/Time Manipulation
by haukex
in thread Date/Time Manipulation
by RobertJ
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |