FIT filename to date conversion code (PHP)

I needed to sort a massive number of FIT files without decoding them so here's a quick'n'dirty function to grab the local start date in the local timezone from the filename from device files, most Garmin use that weird base36 eight character name for FIT and BMP screenshots, other devices like stryd use unix epoch time.

btw Garmin has a year 2047 problem because of the single character year starting at 2010 but by then watches probably will be smaller than a microsd card with massive displays, memory and cpu, maybe not even in the watch itself but remote or in all your clothing, lol

Unfortunately garmin-connect files just make up their own activity number sequentially from their own database counter and they seem meaningless unless someone has some deeper insight, so you have to decode the first global message id 0 to get the first timestamp in the file, haven't written that snippet yet

The regex attempts to search the name even if you've appended other info to it, just has to start and end with something other than the valid characters.

Messy but maybe it will help someone.

ps. forum software doesn't like something in this code and thinks it's a security violation, either the regex or the base convert

https://zerobin.net/?b2bfb1be32a4dc12#5bHF9ub81tJK1bDCifGJJvGHjd2uM0/A/efXEouWzyo=