cj2 said:
That's a good suggestion but I'm sticking with Cor's example as I'm going
to append my own century onto 6 digit dates and I find adjusting VB's
default century settings not as clear to the reader how things are being
done as having it right there in code.
cj2,
Doing it yourself is fine, but watch out. The .Net methods for parsing
dates are standardized and when they are updated, you'll lose out on the
updates because you are parsing your own dates to add your own century. You
can reflect the method to figure out how it's adding the century based on
the data provided:
The internal code actually calls another public method of the Calendar class
called ToFourDigitYear. This method
Microsoft created a variable which can be updated that specifies a
four-digit year where any two-digit year greater than the four-digit year
modulo 100 (so the last two digits in the four-digit year) would be set to
last century, while anything equal to or before it would be this century.
This four-digit year is set on Windows machines in Control Panel under
"Regional and Language Options"->"Regional Options" tab->"Standards and
formats" group box button "Customize"->Date tab->Calendar group box.
To sum this up, using the methods provided by the Microsoft through the .Net
Framework would probably be your best bet. The code isn't really that
obscure or not clear to developers...just a little digging and we are able
to see exactly what's going on in the Framework and if you really need to
show this to the user, then you can using the dialogs provided in the
Control Panel for Regional and Language Options....using your own way of
doing this would be reinventing the wheel...but in the end, it is up to you.
HTH,
Mythran