Poolmath app suggestion: bleach date code converter

Mr Bruce

TFP Guide
Mar 24, 2014
2,438
Greenville, SC
Quick and dirty

try
{
if ((tbDateCode.Text.Length == 5) && (Convert.ToInt16(tbDateCode.Text) >= 0))
{
int fourDigitYear = CultureInfo.CurrentCulture.Calendar.ToFourDigitYear(Convert.ToInt16(tbDateCode.Text.Substring(0, 2)));
DateTime DateCode = new DateTime(fourDigitYear, 1, 1).AddDays(Convert.ToInt16(tbDateCode.Text.Substring(2, 3)));
MessageBox.Show(DateCode.ToShortDateString());
}
else
{
MessageBox.Show("Invalid date code");
}
}
catch
{
MessageBox.Show("Invalid date code");
}
}
 
  • Like
Reactions: Mrmsubeck