I am a cam trying to convert date and time to a string and vice versa, but doing it so that it works for all cultures.
I basically have a text box (tbDateTime) and a label (lbDateTime). The label tells the user in what format the program is waiting for tbDateTime input. Text field input will be used for the MySQL command.
It currently works as follows:
lbDateTime.Text = "DD.MM.YYYY hh:mm:ss";
DateTime date = Convert.ToDateTime(tbDateTime.Text);
String filter = date.ToString("yyyy-MM-dd HH:mm:ss");
Now my question is:
- Is it possible to define a string format for lbDateTime.Text based on the current culture?
- What format is the Convert.ToDateTime function used in?
I hope you help me. I donโt actually have a computer to test different cultures, so Iโm very afraid that I did something wrong.