sclg
May 20, 2026, 11:29am
1
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
arbei
May 21, 2026, 2:39am
2
$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).
sclg
May 21, 2026, 7:58am
3
.... 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??
arbei
May 21, 2026, 9:09am
4
If you want to use the DateTime object directly, you better use DbValue instead of CurrentValue.