Link to home
Start Free TrialLog in
Avatar of Richard Korts
Richard KortsFlag for United States of America

asked on

MySQL timestamp data type

Based on what I've read of this, I'm guessing that if a timestamp is included as a field in a table & a record is inserted into that table, the value of the field is set to the then current date & time (server time) to the nearest second. I'm guessing that you DO NOT include any "value" for the timestamp field.

Of course I'm assuming I can report that value like a datetime.

Is this correct?

Avatar of slinkygn
Flag of United States of America image

Depends on how you defined the field - but, by default, yes.  A single TIMESTAMP field functions, by default, as a "modified date/time" field if you don't give it a value.

You can change that functionality a number of ways, though:
Sorry, missed the last bit there: yes, it functions basically as a DATETIME.  Only key difference is that it'll convert from the defined local timezone to UTC for storage, and then back to the local timezone for retrieval.
Avatar of Richard Korts


To slinkygn

So it will also modify the timestamp if I update the row?

I don't want that.
Avatar of johanntagle
Flag of Philippines image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
As was stated in the link I included.