
Hi, guys,
how can I solve the following problem?
The value 24.09.2019 00:00:00 cannot be converted to a DateTime.
What am I doing wrong here?
Here is my code:
LOCAL TextToDateTime(Value : Text) : DateTime
DateTimeAsVariant := DateTimeValue;
IF NOT TypeHelper.Evaluate(DateTimeAsVariant, Value, '', 'en-us') THEN
ERROR('Der Wert %1 kann nicht in ein DateTime überführt werden', Value);
DateTimeValue := DateTimeAsVariant;
EXIT(DateTimeValue);
Hi Malue,
You can seprate the string in to data and time and then convert it to datetime variable.
TestDate := 24.09.2019;
TestTime := 00:00:00;
TestDateTime := CREATEDATETIME(TestDate,TestTime);
for more details look at the following link
https://docs.microsoft.com/en-us/dynamics-nav/createdatetime-function--datetime-