Calc Builder Support

Calc Builder support
Public write access is disabled. Please login

Use 'hour' in JDate 27.09.2017 08:49

have been trying to set a delivery date using current hour, because order we receive before 11.00 can be done next day, but after 11.00 I have to add a day extra.

I can not get it to work ... have tried this (and variants)

$date = JFactory::getDate();
$currentTime = new JDate ('now');
if ($currentTime ('H') >=11){
do something ...
} else {do something else}

I do not know how to select the current time from JDate, should be possible I guess?

Hope you can help, have tried searching internet but can't find an answer.


Re: Use 'hour' in JDate 27.09.2017 09:11

Have found it ... apologies!

It works like this:
$date = JFactory::getDate();
$hour = $date->format('H');
if ($hour >=11){
do something etc.}
Are you satisfied with our products/services/support?
Please help us to keep improving, add a review at  joomla extensions site and  magento connect

Our clients' feedback