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

create table NOW() #12

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

create table NOW() #12

wants to merge 3 commits into from

Conversation

klaoun
Copy link

@klaoun klaoun commented Jun 17, 2021

hello everyone
I suggest you change now() to "1999-99-99 99:99:99" because now() cannot be a defined value. What do you think ? thanks

@osworx
Copy link

osworx commented Oct 15, 2023

@klaoun : no, see my last PR

@klaoun
Copy link
Author

klaoun commented Oct 16, 2023

hi @osworx i see
try look or read this discussion
it's a same problem for plugin guestbook
Piwigo/Piwigo-Guest-Book#8

@klaoun
Copy link
Author

klaoun commented Oct 16, 2023

the difference

DATETIME and TIMESTAMP
Supported range for DATETIME is '1000-01-01 00:00:00' to '9999-12-31 23:59:59' while for TIMESTAMP, it is '1970-01-01 00:00:01' UTC to '2038-01-09 03:14:07' UTC.
Prior to MySQL 5.6.4, TIMESTAMP requires 4 bytes (+3 bytes for fractional seconds) to store the data while DATETIME requires 8 bytes (+3 bytes for fractional seconds).
As of MySQL 5.6.4, DATETIME requires 5 bytes + 3 additional bytes for fractional seconds data storing.
In MySQL5+, TIMESTAMP value converts from the current time to UTC and vice-versa while DATETIME does not do any conversion.
TIMESTAMP differs with current time zone settings while DATETIME remains constant.
TIMESTAMP data can be indexed while the DATETIME data cannot.
Queries with DATETIME will not be cached but queries with TIMESTAMP will be cached.

TIMESTAMP is better than DATETIME.
then in a timestamp if we want the posted date to be displayed. How should we do it ?
create table commentsonalbum (date TIMESTAMP default CURRENT_TIMESTAMP) index KEY date

Are you ok ?

thanks

@osworx
Copy link

osworx commented Oct 16, 2023

TIMESTAMP and CURRENT_TIMESTAMP should be the best option (have no problems with that in my latest installation).

Have read the discussion at the guestbook (which I do not use), same is valid there.

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

Successfully merging this pull request may close these issues.

2 participants