Reputation: 221
How can I get the system time, like 10.23 PM, and how do I properly deal with time offsets and timezones?
Upvotes: 0
Views: 3153
Reputation: 11
Find your php.ini file location and edit it like this:-
For longitude / latitude, google it with your city name.
IMPORTANT NOTE : After you edit this information, save the php.ini file and close it. Then RESTART your server. Without restarting, you might not be able to see the changes.
Upvotes: 1
Reputation: 2122
<?php
$time_now=mktime(date('h'),date('i'),date('s'));
print date('h.i A',$time_now);
?>
Upvotes: 0
Reputation: 48284
http://www.php.net/manual/en/function.date.php
echo date("g:i A")
Upvotes: -1
Reputation: 124768
Like this:
echo date('g.i A');
Check the PHP date()
reference. date()
takes an optional second argument which you can use to set a custom timestamp. Without this argument, date()
returns the current time.
Upvotes: 1