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

A suggestion regarding datetime handling #188

Open
yairpe opened this issue May 3, 2017 · 2 comments
Open

A suggestion regarding datetime handling #188

yairpe opened this issue May 3, 2017 · 2 comments

Comments

@yairpe
Copy link

yairpe commented May 3, 2017

Right now, the user tables are using mysql TIMESTAMP integer and gmdate("Y-m-d H:i:s") in the code.

To avoid the 1970-2038 limitation (20 years from now), I believe it's better to use DATETIME field and use
(new \DateTime('NOW'))->format('Y-m-d H:i:s')

mysql knows to preserve the current date&time values when switching from TIMESTAMP to DATETIME

@amnah
Copy link
Owner

amnah commented May 5, 2017

This is an extreme edge case ... a far majority of apps built today won't exist 20 years from now. I'd be amazed if any did lol.

Anyhow, if they ever get there they can convert it when the time comes. We'll have a big panic similar to y2k and everyone will be aware of it.

@FedericoBenedetti1976
Copy link

A gmdate is a GMT date :( and not a date in my timezone (Europe/Rome) so when it save for example: $this->logged_in_at = gmdate("Y-m-d H:i:s");
i have: real time 00:55, database saved time with gmdate: 23:53

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

No branches or pull requests

3 participants