Good afternoon all,
As always, thank you in advance for your help.
I have made a windows form in VS 2019 and have a datetimePicker item. The form data is saved in CSV format and then used in Tableau.
The date is stored as ddMMyyyy when saved which is a huge problem. For example, If saved data on 5th Aug 2020, I want it to save it as YYYYMMDD (2020-08-05) but it saves it as 05-08-2020. When I open the saved file, it will show the date as May 08 2020.
I simply want the date format to save as YYYY-MM-DD..
- private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
- {
- dateTimePicker1.Format = DateTimePickerFormat.Custom;
- dateTimePicker1.CustomFormat = "yyyyMMdd";
- }
- Private void textbox8_Textchanged(object sender, EventArgs e)
- xlworksheet.Cells[1, 1] = textBox1.Text;
- xlworksheet.Cells[1, 2] = dateTimePicker1.Value;


Amit GuptaRank #190 · 12.8K reputationPosted Nov 26, 2020, 11:56 PM EST
Ben ThompsonRank #8,839 · 215 reputationPosted Nov 18, 2020, 6:03 AM EST
Sachin SinghRank #66 · 26.2K reputationPosted Nov 17, 2020, 6:48 AM EST
Shane Nicholson64 reputationPosted Nov 17, 2020, 8:44 AM EST
Amit GuptaRank #190 · 12.8K reputationPosted Nov 18, 2020, 6:44 AM EST
Shane Nicholson64 reputationPosted Nov 19, 2020, 10:07 PM EST
Amit GuptaRank #190 · 12.8K reputationPosted Nov 19, 2020, 11:44 PM EST
Shane Nicholson64 reputationPosted Nov 20, 2020, 12:22 AM EST
Amit GuptaRank #190 · 12.8K reputationPosted Nov 20, 2020, 1:13 AM EST
Ben ThompsonRank #8,839 · 215 reputationPosted Nov 20, 2020, 2:48 AM EST
Shane Nicholson64 reputationPosted Nov 20, 2020, 4:30 AM EST
I changed the format to yyyyMMdd and removed it completely and still get the same outcome.