I have Created this code in a custom component that I made:
$date = date(\'m/d/Y h:i:s a\', time()).\"
\";
echo \'Current date and time is: \' . $d
For your second parameter in the JFactory::getdate() - I think you should be specifying the time zone in a second parameter so something like JFactory::getDate($time=now, $tzOffset)
$date = JFactory::getDate($input='now', 'UTC');
// Set the correct time zone based on the server configuration.
$config = JFactory::getConfig();
$date->setOffset($config->getValue('config.offset'));
//Print out Date
echo $date->toFormat();
On a side note it may be easier to use JHtml::date() in the component as this involves less lines and is more 'Joomla native'. See the API page on this here. Then use a code like :
echo JHtml::date($input = 'now', 'm/d/Y h:i:s a', false);
Where $input = now specifies to use the time 'now'. The second parameter is your format for the date and the third parameter means the time setting is set the server time. Rather than the users selected time.