TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Dev Teywa
NA
250
40.6k
how to fix timezone in pdo
May 10 2018 6:05 PM
hi, i want to fix timezone when i'm connect to db but i get this error
my script
error_reporting(E_ALL & ~E_DEPRECATED & ~E_NOTICE);
define('DB_DRIVER', 'mysql');
define('DB_PREFIX', 'em_');
define("DB_HOST", "localhost");
define("DB_USER", "root");
define("DB_PASSWORD", "");
define("DB_DATABASE", "db");
try {
$timezone = "Africa/Casablanca";
$DB = new PDO(DB_DRIVER . ':host=' . DB_HOST . ';dbname=' . DB_DATABASE, DB_USER, DB_PASSWORD, $dboptions);
$DB->exec("SET CHARACTER SET utf8");
$DB->exec("SET time_zone = '{$timezone}'");
} catch (Exception $ex) {
echo $ex->getMessage();
die;
}
?>
Reply
Answers (
0
)
how to publish post after 2hours using php
Payment gateway integration - How to integrate