Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27355

String was not recognized as a valid DateTime.

$
0
0
hello
i use a label to display date in format "d/M/yyyy" by using this line
Code:

datenow.Text = DateTime.ParseExact(datenow.Text, "d/M/yyyy", CultureInfo.InvariantCulture).ToString
but if the user adjust the region from windows control panel "Short date :dd-MM-yyyy" then label display the date in this format dd-MM-yyyy and the error "String was not recognized as a valid DateTime." appear


how can i display date in format "d/M/yyyy" without return the format from region setting?


thank you

Viewing all articles
Browse latest Browse all 27355

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>