Confusion over DateTime types

v2026

I have a database field called StartDate.

In Row_Updating, is $newRow['StartDate'] (or $oldRow) a DateTime entity or a string?

Similarly, in Page_DataRendering (and others) is $this->StartDate->CurrentValue a DateTime entity or a string?

The reason I'm confused is that I seem to get inconsistent behaviour. I have this line in Edit Page, Page_DataRendering....

$header .= "<b>'" . $this->ShowName->CurrentValue . "' on " . date_format(($this->StartDate->CurrentValue),"d/m/Y") . "</b>";

... which was working but after some changes elsewhere now complains that...

date_format(): Argument #1 ($object) must be of type DateTimeInterface, string given

Thanks

$newRow['DateTimeField'] should use DateTime type, not string.

As the error message says, date_format() requires must be of type DateTimeInterface, the error means you have set the CurrentValue to string some where. If you want to show datetime value as string, you can use ConvertToString($this->StartDate->CurrentValue).

.... but this is my point. I haven't done anything to $this->StartDate->CurrentValue

I'm just using it in a server event and wondering how it has become a string??

If you want to use the DateTime object directly, you better use DbValue instead of CurrentValue.