title: How can i put just the date from a dateTimePicker into a variable?
body: <p>I’m using C# and WinForms to try and put just the date from a dateTimePicker into a variable. But I keep getting the date and the time. In the example below textBox1 shows what I’m looking for. But I can’t figure out how to do the same for textBox2. Where it gives the date and time. This isn’t the exact code I’m using in my app, but a simplified example of it for use as an example. How can I modify it to do what I need? Thanks.</p>
  
  <pre><code>    private void dateTimePicker1_CloseUp(object sender, EventArgs e)
      {
          DateTime varDate;
  
          textBox1.Text = dateTimePicker1.Value.ToShortDateString();
  
          varDate = dateTimePicker1.Value;
          textBox2.Text = Convert.ToString(varDate);
      }
  </code></pre>