11
timgno
Re: strtotime in edit mod
  • 2016/6/6 16:00

  • timgno

  • Module Developer

  • Posts: 1504

  • Since: 2007/6/21


I noticed that even for xoops a part of the class remained unchanged

le="color: #000000"><?php case 'mysql': $datestring = 'Y-m-d H:i:s'; break;


You could add this constant, right?

le="color: #000000"><?php case 'mysql': $datestring = _DBTIMESTAMPSTRING; break;


I think that there are too few cases of format, for what it offers php, we should exploit all

12
timgno
Re: strtotime in edit mod
  • 2016/6/7 18:59

  • timgno

  • Module Developer

  • Posts: 1504

  • Since: 2007/6/21



13
luciorota
Re: strtotime in edit mod
  • 2016/6/8 13:08

  • luciorota

  • Module Developer

  • Posts: 219

  • Since: 2007/4/20


Hi
In my latest modules I solved the date format problem using the php DateTime object in this way

in form ...
le="color: #000000"><?php // set date in a timestamp format $item_date = ... // form datetime element $form->addElement(new XoopsFormDateTime(_ITEM_DATE, 'item_date', 15, $this->getVar('item_date'), true));


in form request handler...
le="color: #000000"><?php // get date in a timestamp format $dateTimeObj = DateTime::createFromFormat(_SHORTDATESTRING, $_REQUEST['item_date']['date']); $dateTimeObj->setTime(0, 0, 0); // date timestamp $item_date = $dateTimeObj->getTimestamp() + $_REQUEST['item_date']['time']; unset($dateTimeObj);


I think it's a solution that could work well

Bye Lucio

Login

Donat-O-Meter

Stats
Goal: $15.00
Due Date: Jul 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $15.00
Make donations with PayPal!

Latest GitHub Commits