Can anybody explain to me what this error means and how to correct it?
best regards
Stig
Can anybody explain to me what this error means and how to correct it?
best regards
Stig
Sorry forgot the message:
Error:
Object of class DateTime could not be converted to string
at views/Events22Edit.php:111
at include()
(src/PhpRenderer.php:211)
at PHPMaker2026\Hus3\PhpRenderer->protectedIncludeScope('views/Events22Edit.php', array('Page' => object(Events22Edit), 'Title' => null, 'Language' => object(Language), 'Security' => object(AdvancedSecurity), 'TokenNameKey' => '_csrf_id', 'TokenName' => 'submit', 'TokenValueKey' => '_csrf_token', 'TokenValue' => 'csrf-token', 'DashboardReport' => null, 'SkipHeaderFooter' => false, 'Nonce' => '611v3Ul4UpteN39w/UCO1+ri'))
(src/PhpRenderer.php:177)
at PHPMaker2026\Hus3\PhpRenderer->fetchTemplate('Events22Edit.php', array('Page' => object(Events22Edit), 'Title' => null, 'Language' => object(Language), 'Security' => object(AdvancedSecurity), 'TokenNameKey' => '_csrf_id', 'TokenName' => 'submit', 'TokenValueKey' => '_csrf_token', 'TokenValue' => 'csrf-token', 'DashboardReport' => null, 'SkipHeaderFooter' => false, 'Nonce' => '611v3Ul4UpteN39w/UCO1+ri'))
(src/PhpRenderer.php:148)
at PHPMaker2026\Hus3\PhpRenderer->fetch('Events22Edit.php', array(), true)
(src/PhpRenderer.php:51)
at PHPMaker2026\Hus3\PhpRenderer->render(object(Response), 'Events22Edit.php')
(src/BaseController.php:387)
at PHPMaker2026\Hus3\BaseController->runPage(object(Events22Edit))
(controllers/Events22Controller.php:103)
at PHPMaker2026\Hus3\Events22Controller->edit(object(Request), object(Events22Edit), object(_Event))
(vendor/symfony/http-kernel/HttpKernel.php:195)
at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
(vendor/symfony/http-kernel/HttpKernel.php:77)
at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
(vendor/symfony/http-kernel/Kernel.php:205)
at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
(vendor/symfony/runtime/Runner/Symfony/HttpKernelRunner.php:34)
at Symfony\Component\Runtime\Runner\Symfony\HttpKernelRunner->run()
(vendor/autoload_runtime.php:32)
at require_once('/var/www/bogknold.dk/public_html/hus3/vendor/autoload_runtime.php')
(index.php/:8)
You may post source code near line 111 for discussion.
Here is the code:
<?php if ($Page->start_date->Visible) { // start_date ?>
<div id="r_start_date"<?= $Page->start_date->rowAttributes() ?>>
<label id="elh_events22_start_date" for="x_start_date" class="<?= $Page->LeftColumnClass ?>"><?= $Page->start_date->caption() ?><?= $Page->start_date->Required ? Language()->phrase("FieldRequiredIndicator") : "" ?></label>
<div class="<?= $Page->RightColumnClass ?>"><div<?= $Page->start_date->cellAttributes() ?>>
<span id="el_events22_start_date">
<input type="<?= $Page->start_date->getInputTextType() ?>" name="x_start_date" id="x_start_date" data-table="events22" data-field="x_start_date" value="<?= $Page->start_date->getEditValue() ?>" size="30" maxlength="10" placeholder="<?= HtmlEncode($Page->start_date->getPlaceHolder()) ?>" data-format-pattern="<?= HtmlEncode($Page->start_date->formatPattern()) ?>"<?= $Page->start_date->editAttributes() ?> aria-describedby="x_start_date_help">
<?= $Page->start_date->getCustomMessage() ?>
<div class="invalid-feedback"><?= $Page->start_date->getErrorMessage() ?></div>
</span>
</div></div>
</div>
<?php } ?>
<?php if ($Page->end_date->Visible) { // end_date ?>
By the way it worked fine until I changes the database field to "date" - in other project it causes no problem. Hope you can see what's the problem
best regards
Stig
What was the original data type? "datetime"? What is the database type?
Original data type varchar - MySql database
Data type varchar won't work for the datetime fields for calendar, changing to date (or datetime) is correct.
had similar issue with datetime object blowing up
v2025:
$dt = $newRow['LastModified'];
v2026:
$dt = $newRow['LastModified']->format('Y-m-d');
seemed to fix the problem