xoops forums

timgno

Module Developer
Posted on: 2016/6/6 12:00
timgno
timgno (Show more)
Module Developer
Posts: 1502
Since: 2007/6/21
#11

Re: strtotime in edit mod

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

case 'mysql'
                
$datestring 'Y-m-d H:i:s'
                break;


You could add this constant, right?

case 'mysql'
                
$datestring _DBTIMESTAMPSTRING
                break;


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

timgno

Module Developer
Posted on: 2016/6/7 14:59
timgno
timgno (Show more)
Module Developer
Posts: 1502
Since: 2007/6/21
#12

Re: strtotime in edit mod

The problem for me continues

https://github.com/XoopsLanguages/italian/issues/2

luciorota

Module Developer
Posted on: 2016/6/8 9:08
luciorota
luciorota (Show more)
Module Developer
Posts: 174
Since: 2007/4/20
#13

Re: 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