Reputation: 1
Using QCubed 2.3 I am trying to set an ending date to way in the future if the current date field is null. Essentially I want to load the Ending date (Edate) to this future date when creating a new record.
Here is what I am trying to do with code from MetaControllGen.Class.php /** * Create and setup QDateTimePicker calEdate * @param string $strControlId optional ControlId to use * @return QDateTimePicker */ public function calEdate_Create($strControlId = null) { $objhelp = Help::LoadByTag('pgdbendate'); $this->calEdate = new QJsCalendar($this->objParentObject, $strControlId); $this->calEdate->Name = QApplication::Translate('Ending Date'); $this->calEdate->HtmlAfter = 'qmark.' border = 0> '.$objhelp->DocData.' '; $this->calEdate->ToolTip = 'This data display will end on this date. Use for future for permanent data';
<-- if (!$this->objPagedb->Edate) $this->objPagedb->Edate = "Dec 31 2099" ; -->
$this->calEdate->DateTime = $this->objPagedb->Edate;
$this->calEdate->CalendarType = QJsCalendarType::Date;
return $this->calEdate;
}
Thanks for any help you can give.
Upvotes: 0
Views: 26
Reputation: 1
I figured it out and answered my own question with the following code:
if (!$this->objPagedb->Edate) {
$newdate = New QdateTime('now');
$newdate->modify("+10 years");
$this->objPagedb->Edate = $newdate ;
}
$this->calEdate->DateTime = $this->objPagedb->Edate;
Hope this helps someone else still using Qcubed 2.3
Upvotes: 0