The fun part of shell scripting is writing apparently perfectly Wirth-friendly code of immaculate Algol-like structure, peppered with inline bits of line noise that do the actual work. This is management-friendly because then they think they understand the immaculate structure, and because they don't understand the line noise it must therefore be simple.
( ew. )
Note I've missed my chance to inline even more of the magic. The YY to YYYY conversion can be inlined with nawk and ?: and the script is less than polished in general. But that can be fixed next version. In fact, I'll see if I can get everything from logins on inside the final if.