webForumDet fria alternativet
Logga in / Bli medlem

Timestamp

Databaser & SQL

3 svar · 371 visningar · startad av AG

Medlem sedan mars 20001 266 inlägg
Trådstart#1

Läste följande om TIMESTAMP för MySQL när jag Googlade runt lite.

A TIMESTAMP column is useful for recording the date and time of an INSERT or UPDATE operation because it is automatically set to the date and time of the most recent operation if you don't give it a value yourself. You can also set it to the current date and time by assigning it a NULL value.

Verkar kanon tänkte jag, att den automatiskt skulle lägga till datum/tid. Så jag gjorde en test. Men inte lade den till något per automatik, vad är felet?

Andreas

Medlem sedan juni 200032 967 inlägg
#2

Vad använder du för version av MySQL, samt vilken typ av databas använder du?

Följande går att läsa på www.mysql.com:

Beginning with MySQL 4.1.1, the MySQL server can be run in MAXDB mode. When the server runs in this mode, TIMESTAMP is identical with DATETIME. That is, if the server is running in MAXDB mode at the time that a table is created, TIMESTAMP columns are created as DATETIME columns. As a result, such columns use DATETIME display format, have the same range of values, and there is no automatic initialization or updating to the current date and time.

mvh

Medlem sedan mars 20001 266 inlägg
#3

Fick det att fungera på annan dator, när jag använda myswql prompten 'alter table x add Tstamp TIMESTAMP;'

Dock funderar jag på om det finns något som gör att man i mysql kan sätta standardtid till EST.

Andreas

Medlem sedan mars 20001 266 inlägg
#4

Hittade följande sida:
http://dev.mysql.com/doc/mysql/en/Time_zone_support.html

Men det verkar som det bara fungerar på Unix, testade 'SET GLOBAL timze_zone = EST;' men får upp 'ERROR 1193: Unknown system variable 'time_zone''.
Någon lösning runt?

Andreas

260 ms totalt · 4 externa anrop · v20260731065814-full.51f67c91
126 ms — deklarationer (db)
0 ms — hämta statistik (cache)
132 ms — hämta tråd, inlägg och bilagor (db)
122 ms — ändringar (db)