Phpmyadmin feed a timestamp column with “0000-00-00 00:00:00”?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
in PhpMyAdmin (OVH Mutu), a table with column type timestamp.
Impossible to put into this colum a timestamp :
Always display datetime like 2017-01-09 23:02:01 !!!
It generate several problmes : default current_timestamp give in this table "0000-00-00 00:00:00". Calculate delays is impossible.
The only way : define a int(11) type column.
An idea ?...
mysql datetime timestamp
bumped to the homepage by Community♦ 16 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
in PhpMyAdmin (OVH Mutu), a table with column type timestamp.
Impossible to put into this colum a timestamp :
Always display datetime like 2017-01-09 23:02:01 !!!
It generate several problmes : default current_timestamp give in this table "0000-00-00 00:00:00". Calculate delays is impossible.
The only way : define a int(11) type column.
An idea ?...
mysql datetime timestamp
bumped to the homepage by Community♦ 16 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
in PhpMyAdmin (OVH Mutu), a table with column type timestamp.
Impossible to put into this colum a timestamp :
Always display datetime like 2017-01-09 23:02:01 !!!
It generate several problmes : default current_timestamp give in this table "0000-00-00 00:00:00". Calculate delays is impossible.
The only way : define a int(11) type column.
An idea ?...
mysql datetime timestamp
in PhpMyAdmin (OVH Mutu), a table with column type timestamp.
Impossible to put into this colum a timestamp :
Always display datetime like 2017-01-09 23:02:01 !!!
It generate several problmes : default current_timestamp give in this table "0000-00-00 00:00:00". Calculate delays is impossible.
The only way : define a int(11) type column.
An idea ?...
mysql datetime timestamp
mysql datetime timestamp
edited Oct 13 '17 at 8:30
a_horse_with_no_name
41.4k779116
41.4k779116
asked Jan 9 '17 at 22:08
JMBJMB
62
62
bumped to the homepage by Community♦ 16 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 16 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
If you need to calculate with the timestamp field, you simply may use SELECT UNIX_TIMESTAMP(yourtimestampfield);
. I decided to use this instead of the int(11)
because of the built in function on update CURRENT_TIMESTAMP
which shows this format 0000-00-00 00:00:00
.
Also inside of mysql queries yo may use it the reverse way like UPDATE user SET logouttime = FROM_UNIXTIME(UNIX_TIMESTAMP(logintime)+3600) WHERE user_id = 12345;
Hope this helps.
Many thanks for help. But why my TIMESTAMP column do not give a TIMESTAMP ? In my mind a TIMESTAMP colum give Timestamp, and a DATETIME column give a DATETIME ?! Very curiuous for me...
– JMB
Jan 10 '17 at 8:49
Because a Unix timestamp is different than a SQL databasetimestamp
.
– ypercubeᵀᴹ
Mar 31 '18 at 21:28
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "182"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f160472%2fphpmyadmin-feed-a-timestamp-column-with-0000-00-00-000000%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
If you need to calculate with the timestamp field, you simply may use SELECT UNIX_TIMESTAMP(yourtimestampfield);
. I decided to use this instead of the int(11)
because of the built in function on update CURRENT_TIMESTAMP
which shows this format 0000-00-00 00:00:00
.
Also inside of mysql queries yo may use it the reverse way like UPDATE user SET logouttime = FROM_UNIXTIME(UNIX_TIMESTAMP(logintime)+3600) WHERE user_id = 12345;
Hope this helps.
Many thanks for help. But why my TIMESTAMP column do not give a TIMESTAMP ? In my mind a TIMESTAMP colum give Timestamp, and a DATETIME column give a DATETIME ?! Very curiuous for me...
– JMB
Jan 10 '17 at 8:49
Because a Unix timestamp is different than a SQL databasetimestamp
.
– ypercubeᵀᴹ
Mar 31 '18 at 21:28
add a comment |
If you need to calculate with the timestamp field, you simply may use SELECT UNIX_TIMESTAMP(yourtimestampfield);
. I decided to use this instead of the int(11)
because of the built in function on update CURRENT_TIMESTAMP
which shows this format 0000-00-00 00:00:00
.
Also inside of mysql queries yo may use it the reverse way like UPDATE user SET logouttime = FROM_UNIXTIME(UNIX_TIMESTAMP(logintime)+3600) WHERE user_id = 12345;
Hope this helps.
Many thanks for help. But why my TIMESTAMP column do not give a TIMESTAMP ? In my mind a TIMESTAMP colum give Timestamp, and a DATETIME column give a DATETIME ?! Very curiuous for me...
– JMB
Jan 10 '17 at 8:49
Because a Unix timestamp is different than a SQL databasetimestamp
.
– ypercubeᵀᴹ
Mar 31 '18 at 21:28
add a comment |
If you need to calculate with the timestamp field, you simply may use SELECT UNIX_TIMESTAMP(yourtimestampfield);
. I decided to use this instead of the int(11)
because of the built in function on update CURRENT_TIMESTAMP
which shows this format 0000-00-00 00:00:00
.
Also inside of mysql queries yo may use it the reverse way like UPDATE user SET logouttime = FROM_UNIXTIME(UNIX_TIMESTAMP(logintime)+3600) WHERE user_id = 12345;
Hope this helps.
If you need to calculate with the timestamp field, you simply may use SELECT UNIX_TIMESTAMP(yourtimestampfield);
. I decided to use this instead of the int(11)
because of the built in function on update CURRENT_TIMESTAMP
which shows this format 0000-00-00 00:00:00
.
Also inside of mysql queries yo may use it the reverse way like UPDATE user SET logouttime = FROM_UNIXTIME(UNIX_TIMESTAMP(logintime)+3600) WHERE user_id = 12345;
Hope this helps.
answered Jan 9 '17 at 23:18
ddlabddlab
1084
1084
Many thanks for help. But why my TIMESTAMP column do not give a TIMESTAMP ? In my mind a TIMESTAMP colum give Timestamp, and a DATETIME column give a DATETIME ?! Very curiuous for me...
– JMB
Jan 10 '17 at 8:49
Because a Unix timestamp is different than a SQL databasetimestamp
.
– ypercubeᵀᴹ
Mar 31 '18 at 21:28
add a comment |
Many thanks for help. But why my TIMESTAMP column do not give a TIMESTAMP ? In my mind a TIMESTAMP colum give Timestamp, and a DATETIME column give a DATETIME ?! Very curiuous for me...
– JMB
Jan 10 '17 at 8:49
Because a Unix timestamp is different than a SQL databasetimestamp
.
– ypercubeᵀᴹ
Mar 31 '18 at 21:28
Many thanks for help. But why my TIMESTAMP column do not give a TIMESTAMP ? In my mind a TIMESTAMP colum give Timestamp, and a DATETIME column give a DATETIME ?! Very curiuous for me...
– JMB
Jan 10 '17 at 8:49
Many thanks for help. But why my TIMESTAMP column do not give a TIMESTAMP ? In my mind a TIMESTAMP colum give Timestamp, and a DATETIME column give a DATETIME ?! Very curiuous for me...
– JMB
Jan 10 '17 at 8:49
Because a Unix timestamp is different than a SQL database
timestamp
.– ypercubeᵀᴹ
Mar 31 '18 at 21:28
Because a Unix timestamp is different than a SQL database
timestamp
.– ypercubeᵀᴹ
Mar 31 '18 at 21:28
add a comment |
Thanks for contributing an answer to Database Administrators Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f160472%2fphpmyadmin-feed-a-timestamp-column-with-0000-00-00-000000%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown