For the diametrical opposite, here's one time on an embedded system where I really didn't want to bring in a library dependency, so I wrote an inconspicuous-looking good-enough version:
y = (d - (d + 366 + (d >= 47847)) / 1461 + (d >= 47847)) / 365;
d = d - (d + 365 + (d >= 47848)) / 1461 + (d >= 47848) - y * 365;
y += 1970;