At the moment of answering, in Caracas they should be the 02:38PM
Look at the code examples. If you do not want the seconds, you just have to omit the s
.
If it does not work for you, the problem is elsewhere, not in the code.
<?php
date_default_timezone_set('America/Caracas');
echo date('H:i:sA');
echo "\n";
echo date('h:i:sA');
echo "\n";
echo date('H:iA');
echo "\n";
echo date('h:iA');
?>
Resultado
14:38:06PM
02:38:06PM
14:38PM
02:38PM
EDIT
You can also use PHP's DateTime
class, which is more flexible and powerful than the date
function.
You create a $date
object by new
and apply the zone to it. Then you make echo
of the object with the format you want.
Example:
Code:
$date = new DateTime("now", new DateTimeZone('America/Caracas'));
echo $date->format('H:i:sA');
Result:
14:54:35PM