webForumDet fria alternativet

Timestamp

3 svar · 371 visningar · startad av AG

AGMedlem sedan mars 20001 229 inlägg
#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

@ndersMedlem sedan juni 200026 914 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

AGMedlem sedan mars 20001 229 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

AGMedlem sedan mars 20001 229 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

Genererad på 382 ms · cache AV · v20260730165559-full.f96bc7eb