Reputation:
I want to display time store in DB but when i display it show my wrong time with -5 hour less with actual. Suppose i have
$time = '2013-03-18 11:48:26';
$time = date('g:i A M dS', strtotime($time));
echo $time;
then it display 6:48 AM Mar 18th it should display 11:48 AM Mar 18th can someone tell me what is wrong. thanks.
Upvotes: 1
Views: 1716
Reputation: 19882
If you want to display time from you database you can use this query.
SELECT NOW();
And it will give you server time. you can create a helper which can query from model for time and you can call the helper anywhere.
Upvotes: 0
Reputation: 5809
check your server time zone setting.
or change using php
// example for japan time zone
date_default_timezone_set('Asia/Tokyo');
Upvotes: 1