D
dotnw
My SQL Server database is held on a server in the USA.
Inside my database table, I have some date values.
They are represented in USA format = month/day/year
If someone looks at my website in the USA, I want them to see dates
represented in USA format. If someone looks at my website in the UK, I
want them to see the date values in UK format which is different to USA
format. It is day/month/year.
I have tried using CultureInfo, ParseExact, and Parse, but every time I
get this error:
String was not recognized as a valid DateTime.
My simple 2 lines of code is below. Please note the "c" variable is
the specific culture info, set to either "en-US" or "en-GB", depending
on which country the user is in. If I set this to "en-GB", then I get
the error.
Dim datReviewDate As DateTime = DateTime.ParseExact("1/31/2004",
"mmddyyyy", c)
Label1.Text = datReviewDate.ToShortDateString
Thanks for any ideas,
Regards, dnw.
Inside my database table, I have some date values.
They are represented in USA format = month/day/year
If someone looks at my website in the USA, I want them to see dates
represented in USA format. If someone looks at my website in the UK, I
want them to see the date values in UK format which is different to USA
format. It is day/month/year.
I have tried using CultureInfo, ParseExact, and Parse, but every time I
get this error:
String was not recognized as a valid DateTime.
My simple 2 lines of code is below. Please note the "c" variable is
the specific culture info, set to either "en-US" or "en-GB", depending
on which country the user is in. If I set this to "en-GB", then I get
the error.
Dim datReviewDate As DateTime = DateTime.ParseExact("1/31/2004",
"mmddyyyy", c)
Label1.Text = datReviewDate.ToShortDateString
Thanks for any ideas,
Regards, dnw.