Setting and viewing Date and Time in Ubuntu Linux

So, now I have a Vagrant server running properly but the date time it’s completly wrong, my timezone it’s America/Bogota and I setted accordly in the php.ini configuration, if you don’t know how to do this follow those simple steps.

1. Open with privileged user this file, like always I open it with vim but you can use any text editor
sudo vim /etc/php5/apache2/php.ini
2. Search for the line under [DATE] config that says date.timezone and remove the semicolon at the beggining of the line (if exists) and type your timezone after the equals sign. (You can find the supported timezones here)
date.timezone = America/Bogota
3. Save the file and restart the apache server.

But I’m still getting a different time, because the configuration problem not only was on Apache but in the server too. When I type the date command it returns a different timezone (UTC) but I want to set it to (GMT-5). To set the timezone in the server just use

sudo dpkg-reconfigure tzdata

NOTE: After doing this I still was getting the wrong date on PHP, and that’s because Laravel in his configuration file (app/config/app.php) has a timezone attribute too and it overrides the other configurations, set it properly and now that’s really all.

Follow the steps and that’s all.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s