N
N
NINFERIO2020-12-09 18:25:07
C++ / C#
NINFERIO, 2020-12-09 18:25:07

Unable to implicitly convert string to DateTime?

In short, there is a text box and a database in which the value from the text box should be written, but I have problems converting the date to a string. Screen5fd0ec389acdc714335811.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
NINFERIO, 2020-12-09
@NINFERIO

Solution:
schedules.Date = DateTime.Parse(dtpDate.Text);
schedules.Time = TimeSpan.Parse(txbTime.Text);

S
soloveid, 2020-12-09
@soloveid

Well, if you continue in your style, then you need to use
- DateTime.ParseExact for DateTime (dtpDate)
- TimeSpan.ParseExact for TimeSpan (txbTime)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question