开发者

cannot implicity convert type 'string' to 'system,DateTime'

i am creating a project . i want to download the files from ftp . i can download it but only by todays date in dateTimePicker1. it only downloads systems date. my code is

txtSelectedDate.Text = DateTime.Now.ToString("yyyyMMdd");
dateTimePicke1.Value = DateTime.NoW;

can anyone say me how to download files b开发者_开发技巧y selecting date in dateTimePicker1 not by Current date. thanks in advance.


Select a different date on the control "dateTimePicker1" use the code below:

txtSelectedDate.Text = dateTimePicker1.Value;

or

txtSeletedDate.Text = dateTimePicker1.Value.ToShortDateString();

DateTimePicker allows you to change the date you are using and you should not use DateTime.Now, you shall assign the selected date to your text property.


I believe what you are looking for is the DateTime.ParseExact command, like so:

DateTime.ParseExact(MyString, "yyyy-MM-dd HH:mm tt", null);

If you assign that to your dateTimePicker1 you will be able to give it any date.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜