The timestamp data type stores the time that a row was last changed : timestamp « Data Types « MySQL Tutorial

MySQL Tutorial
1. Introduction
2. Select Query
3. Database
4. Table
5. Table Join
6. Subquery
7. Insert Update Delete
8. Logic Operator
9. View
10. Data Types
11. Procedure Function
12. Cursor
13. Trigger
14. Date Time Functions
15. Comparison Functions Operators
16. Aggregate Functions
17. Cast Functions Operators
18. Control Flow Functions
19. Encryption Compression Functions
20. Information Functions
21. Math Numeric Functions
22. Miscellaneous Functions
23. String Functions
24. Regular Expressions
25. Data Dictionary
26. MySQL Utilities
27. Privilege
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
MySQL Tutorial » Data Types » timestamp 
10. 24. 1. The timestamp data type stores the time that a row was last changed

TIMESTAMP column will be set to the current date and time whenever that row is updated or inserted in the table.

TIMESTAMP can only handle dates in the range 1970 through 2037.

TIMESTAMP data can be held with the maximum resolution of one second.

TIMESTAMP can have a number of external formats.

These can be made up of any even number of digits from 2 to 14.

TIMESTAMP fields are set to the current time if you do not write anything to them.

MySQL sets a TIMESTAMP column to the current time if NULL (or NOW()) is written to it.

Illegal values will be discarded and replaced with the "zero" value for this field type.

MySQL is flexible in the formats accepting for the TIMESTAMP.

For example, it will accept 2000-05-12, 2000+05+12, and 20000512.

If the field is left out when doing an insert or update, it will only update the first TIMESTAMP field in the table.

Subsequent TIMESTAMP fields will contain the zero value if not set explicitly.

If you have a DATE value and want to write it to a DATETIME or TIMESTAMP column, MySQL will insert 00:00:00 for the time portion.

The format varies according to the length.

For example to store the same information as DATETIME, you would specify a length of 14 whereas to store the DATE you would specify a length of 8.

Timestamp DefinitionFormat
TIMESTAMP(2)YY
TIMESTAMP(4)YYYY
TIMESTAMP(6)YYMMDD
TIMESTAMP(8)YYYYMMDD
TIMESTAMP(10)YYMMDDHHMM
TIMESTAMP(12)YYMMDDHHMMSS
TIMESTAMP(14)YYYYMMDDHHMMSS


10. 24. timestamp
10. 24. 1. The timestamp data type stores the time that a row was last changed
10. 24. 2. TIMESTAMP NULL DEFAULT '0000-00-00 00:00:00'
10. 24. 3. TIMESTAMP NULL DEFAULT NULL
10. 24. 4. You can include the NULL attribute in the definition of a TIMESTAMP column to allow the column to contain NULL values. For example:
10. 24. 5. mysql> SELECT MICROSECOND('2010-12-10 14:12:09.019473');
10. 24. 6. TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.