Some records are more complete than others. Some military arms have the date of manufacture stamped right onto the reciever or barrel. Others used codes. It's more difficult with armsmakers which either did not use the western calendar or did not mark their arms chronologically. In some cases, serial number surveys combined with known production figures have allowed collectors to deduce a probable manufacturing date.
Now, for some American manufacturers, the records are made available to researchers and you can get amazing detail.