0

please, prior to responding with "Duplicate Question", I did not find anything like that one here on Stackoverflow. am injecting a timestamp into my mysql database the following way:

    $insertData['enddate'] = strtotime($this->input->post('openDays'));

this returns the date, but without a time, the output is e. g. 09/17/2013 00:00h

The hour is always the same, and I need this to always be 17:00h

Searching here and on google, I found ways to add minutes or hours to the time, but I always need this to be 17:00h, it is not a variable + XX hours.

Any clue on how to get this solved?

Thanks ;)

4

1 回答 1

1

假设传入的数据只是日期(09/17/2013没有时间组件),您只需将其写为字符串即可:

$insertData['enddate'] = strtotime($this->input->post('openDays').' 17:00:00');

strtotime函数足够聪明,可以进行所需的翻译。

于 2013-11-04T19:13:25.960 回答