DateTime error

0

I'm getting a date of two different dateTimes and concatenating on a single variable, but when I write the contents of that variable it looks like this:

Period: System.Windows.Forms.DateTimePicker, Value: 20/07/2017 15:52:45 To System.Windows.Forms.DateTimePicker, Value: 07/20/2017 15:52:45

 String dataTime = tempoInicialEXP.Text + " Até " + tempoFinalEXP.Text;
    
asked by anonymous 20.07.2017 / 21:03

1 answer

1

You have to use the Value property of DateTimePicker :

Example:

tempoInicialEXP.Value.ToString();
tempoInicialEXP.Value.ToString("dd/MM/yyyy HH:mm");
tempoInicialEXP.Value.ToShortDateString();
    
20.07.2017 / 21:20