Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue when saving datetime #38

Open
itsrachelfish opened this issue Mar 25, 2016 · 4 comments
Open

Issue when saving datetime #38

itsrachelfish opened this issue Mar 25, 2016 · 4 comments

Comments

@itsrachelfish
Copy link
Member

It seems like there is an issue when dates are saved (on the production server at least). The created date is being saved in MST but the modified date is being saved in UTC. This might be because the MySQL server is configured to use MST but laravel is configured to use UTC. The created_at column is updated by using a default value in the database where updated_at is actually generated by Laravel.

This might be a common / known issue in Laravel, I think it would be worth looking in the documentation or Laravel support forums.

@marcj303
Copy link
Contributor

This might solve the issue:
http://laravel.io/forum/10-16-2015-set-default-mysql-timezone-on-connect

You can add the following key to your mysql connection in the config:
'options' => array(
\PDO::MYSQL_ATTR_INIT_COMMAND => 'SET time_zone = '+00:00''
)
This example sets your PDO database connection to UTC. So if the database itself runs in another timezone, your app wil always get the timestamps as UTC.

@marcj303
Copy link
Contributor

I think this might have been resolved in the laravel update.

@itsrachelfish
Copy link
Member Author

itsrachelfish commented Mar 15, 2017

@marcj303 I actually fixed this on production by modifying the database settings manually.

Going to leave this issue open until we upgrade the version of Laravel we're using.

@itsrachelfish
Copy link
Member Author

We should double check to see if this issue is still relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants