Quantcast
Channel: XOOPS Web Application System :: Forum
Viewing all articles
Browse latest Browse all 141

Re: strtotime in edit mod [by luciorota]

$
0
0
Xoops Development::strtotime in edit mod
Hi
In my latest modules I solved the date format problem using the php DateTime object in this way

in form ...
// 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...
// get date in a timestamp format
$dateTimeObj DateTime::createFromFormat(_SHORTDATESTRING$_REQUEST['item_date']['date']);
$dateTimeObj->setTime(000);
// date timestamp
$item_date $dateTimeObj->getTimestamp() + $_REQUEST['item_date']['time'];
unset(
$dateTimeObj);


I think it's a solution that could work well

Bye Lucio

Viewing all articles
Browse latest Browse all 141

Trending Articles