DateTime is not a number, was: StrToDateTime Function Values

I am using
DateString="10-08-12023 15:30:00";
TradeDT = StrToDateTime(DateString);
but in explorer it is showing the value as
even in the watchlist also it shows the same value

Can anyone please guide, I checked the local system regional settings, everything is fine.
Even tried with _DT function same result.

Can anyone help.

@tradeconcorde, 12023 seems a bit too far for any strategy!

Anyway, try this:

DateString="10-08-2023 15:30:00";
TradeDT = StrToDateTime(DateString);
Filter = 1;
Addcolumn(TradeDT, "Trade DT", formatDatetime);

To display dates when running an exploration you should use one of the the supported format as documented in the function AddColumn(), although in a recent version the formatDateTimeISO seems to not work as expected (see formatDateTimeISO produces date with no dashes).

1 Like

Read the manual.

DateTime() manual says:

VERSION 5.27 and above: It is important to understand that DateTime is not a simple number but rather bitset

See also:

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.