M
MattB
Hi, I have a vb.net/asp.net 1.1 web application that may be used in
other cultures where dates are formatted differently. I have three
controls (either DropDowns or TextBoxes) one for year, one for month,
and one for day.
I'd like to be able to convert this to a DateTime type of variable and
not have to rely on or find the localization settings.
My idea was to populate the DateTime.Year, DateTime.Month and
DateTime.Day from the controls, (like Date.Year = txtYear.Text) but
those properties are read-only.
I know I could make a string like "12-19-2005" and do a
strDate.ToDateTime but that will break as soon as the application is
used where dd-mm-yyyy is the norm.
So If I have three variables representing year, month, and day what's
the best way to convert to Date without relying on any kind of
localization setting? Thanks!
Matt
other cultures where dates are formatted differently. I have three
controls (either DropDowns or TextBoxes) one for year, one for month,
and one for day.
I'd like to be able to convert this to a DateTime type of variable and
not have to rely on or find the localization settings.
My idea was to populate the DateTime.Year, DateTime.Month and
DateTime.Day from the controls, (like Date.Year = txtYear.Text) but
those properties are read-only.
I know I could make a string like "12-19-2005" and do a
strDate.ToDateTime but that will break as soon as the application is
used where dd-mm-yyyy is the norm.
So If I have three variables representing year, month, and day what's
the best way to convert to Date without relying on any kind of
localization setting? Thanks!
Matt