# A Visual Basic Application's Unnecessary Padding for Historical Dates

DevFeed: [A Visual Basic Application's Unnecessary Padding for Historical Dates](<https://devfeed.tech/articles/codesod-historical-pads-59168.md>)

Original publisher: [Read original article](<https://thedailywtf.com/articles/historical-pads>)

Author: Remy Porter

Published: 2026-09-24T06:30:00Z

Content type: article

Language: en

Sources: [The Daily WTF](<https://devfeed.tech/sources/the-daily-wtf.md>)

Topics: [Code](<https://devfeed.tech/topics/code.md>), [Visual Basic](<https://devfeed.tech/topics/visual-basic.md>)

Tags: [application](<https://devfeed.tech/tags/application.md>), [code](<https://devfeed.tech/tags/code.md>), [codesod](<https://devfeed.tech/tags/codesod.md>)

## AI overview

The article examines a legacy Visual Basic application's code for padding years below 1000 with a leading zero. The behavior was unnecessary because the application handled no pre-1000 dates, and later code reformatted the dates using built-in date types.

## Source excerpt

Tim inherited a fairly antique Visual Basic application some time back. Yes, Visual Basic, not VB .Net. The application is old enough that we might consider it "vintage" or "historical"; it certainly dates from before the millennium. But it has its own unique approach to handling historical dates: mnYear% = CInt(Year(vntDate)) If mnYear% < 1000 Then msYear$ = "0" & Trim$(CStr(mnYear%)) Else msYear$ = Trim$(CStr(mnYear%)) End If Insert obligatory complaints about Hungarian notation. What even is vnt. Now, one important thing about this program: it didn't have to handle dates back into the middle ages, or honestly, historical dates at all. But someone decided they wanted to make sure that if someone wanted to track the founding of the Tang Dynasty in here, you could make sure it was padded out to four digits. Unfortunately, if you wanted to track, say, the death of Caesar Augustus in 14AD, that'll only pad out to "014", which raises the question: what even is the point of this padding? And how many pre-1000 dates did the program handle? The answer to both questions is "none". Later code reformatted the date anyway, using the built in date types, even. [Advertisement] Keep all your packages and Docker containers in one place, scan for vulnerabilities, and control who can access different feeds. ProGet installs in minutes and has a powerful free version with a lot of great features that you can upgrade when ready.Learn more.