Home Database Mysql Tutorial MySQL5.6时间类型timestamp和datetime有了重大改变

MySQL5.6时间类型timestamp和datetime有了重大改变

Jun 07, 2016 pm 05:40 PM
datetime timestamp

在MySQL5.5里(或更老的版本MySQL5.1)timestamp类型一个表里只允许一列字段拥有自动插入时间和自动更新时间、或只允许一列字段有自动插入时间,网站空间,另一列字段不能有自动更新时间。

但从MySQL5.6里,打翻了这一传统理念,香港服务器,香港虚拟主机,以上条件均可以出现,并且datetime类型也拥有了timestamp类型的功能。

相关mysql视频教程推荐:《mysql教程

以下是演示:

这是MySQL5.5的(timestamp类型一个表里只允许一列字段拥有自动插入时间和自动更新时间):

这是MySQL5.6的(timestamp类型一个表里可以有多列字段拥有自动插入时间和自动更新时间):

这是MySQL5.5的(只允许一列字段有自动插入时间,另一列字段不能有自动更新时间)

这是MySQL5.6的(一列字段有自动插入时间,另一列字段也能有自动更新时间)

MySQL5.6(datetime类型也拥有了timestamp类型的功能)

本文出自 “贺春旸的技术专栏” 博客,请务必保留此出处。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Repo: How To Revive Teammates
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to convert DateTime to integer in Python? How to convert DateTime to integer in Python? Sep 05, 2023 pm 10:21 PM

The manipulation of date and time values ​​is an important aspect of programming, and the Python language provides a useful built-in module for this called datetime. However, in some cases, you may need to convert a DateTime object to an integer value in order to perform specific operations or calculations. There are multiple ways to convert a DateTime to an integer in Python, each with its own advantages and disadvantages. In this article, we'll take a closer look at these methods and examine when each method is appropriate to use. After reading this article, you will have a complete understanding of how to efficiently convert DateTime objects to integers in Python and be able to choose the most appropriate method for your specific programming task. Method 1: Use timestamp

Get today's date using DateTime.Today function in C# Get today's date using DateTime.Today function in C# Nov 18, 2023 pm 12:41 PM

Getting today's date using DateTime.Today function in C# requires specific code examples C# is an object-oriented programming language that provides many built-in classes and methods to handle dates and times. Among them, the DateTime class has some very useful methods, such as the Today property, which can be used to obtain today's date. Here is a sample code that demonstrates how to get today's date using the DateTime.Today function in C#: usingSystem;

How to use DateTime in Python How to use DateTime in Python Apr 19, 2023 pm 11:55 PM

All data are automatically assigned a "DOB" (Date of Birth) at the beginning. Therefore, it is inevitable to encounter date and time data when processing data at some point. This tutorial will take you through the datetime module in Python and using some peripheral libraries such as pandas and pytz. In Python, anything related to date and time is handled by the datetime module, which further divides the module into 5 different classes. Classes are simply data types that correspond to objects. The following figure summarizes the 5 datetime classes in Python along with commonly used attributes and examples. 3 useful snippets 1. Convert string to datetime format, maybe using datet

How to solve the timestamp 2038 problem of Mysql How to solve the timestamp 2038 problem of Mysql Jun 02, 2023 am 10:13 AM

The timestamp refers to the total number of seconds from 00:00:00 on January 1, 1970, Greenwich Mean Time (08:00:00 on January 1, 1970, Beijing time) to the present. Various versions of MySQL are deployed in the production environment, including three major versions of MySQL 5.5/5.6/5.7 and N minor versions. Due to the poor upward compatibility of MySQL, the same SQL behaves differently in different versions. As follows The timestamp data type is introduced in detail from several aspects. Timestamp data access In the above three major versions of MySQL, the value range of the default timestamp (Timestamp) type is’1970-01-0100:00:01&r

Use the DateTime.AddDays function in C# to add a specified number of days to a date Use the DateTime.AddDays function in C# to add a specified number of days to a date Nov 18, 2023 pm 03:08 PM

Use the DateTime.AddDays function in C# to add a specified number of days to a date. In C# programming, we often encounter situations where we need to add and subtract dates. The DateTime class in C# provides many convenient methods and properties for working with dates and times, including the AddDays function, which can be used to add a specified number of days to a specified date. Here is a specific code example that demonstrates how to use the DateTime.AddDays function to add a specified number of days to a date:

What are the options for calendar and date libraries in Python? What are the options for calendar and date libraries in Python? Oct 21, 2023 am 09:22 AM

There are many excellent calendar libraries and date libraries in Python for us to use. These libraries can help us handle date and calendar related operations. Next, I will introduce you to several common choices and provide corresponding code examples. Datetime library: Datetime is Python's built-in date and time processing module. It provides many date and time related classes and methods, which can be used to process dates, times, time differences and other operations. Sample code: importdatetime#Get the current date

What to do if mysql datetime error occurs What to do if mysql datetime error occurs Feb 15, 2023 am 10:12 AM

Solution to mysql datetime error: 1. Change datetime to timestamp timestamp; 2. Upgrade MySQL to a higher version; 3. Execute the "ALTER USER 'root'@'localhost' IDENTIFIED BY 'root1' PASSWORD EXPIRE NEVER;" command That’s it.

PHP formats a GMT/UTC date/time PHP formats a GMT/UTC date/time Mar 21, 2024 am 10:41 AM

This article will explain in detail how to format a GMT/UTC date/time with PHP. The editor thinks it is quite practical, so I share it with you as a reference. I hope you can gain something after reading this article. Introduction to Formatting GMT/UTC Date/Time in PHP In PHP, formatting GMT/UTC date/time is crucial for correctly displaying and handling cross-time zone dates. This article will explain how to format a GMT/UTC date/time using PHP's DateTime class, as well as the various formatting options available. DateTime class The DateTime class represents a date and time. It can store and manipulate date/time values ​​in time zones such as GMT/UTC. To create a new Da

See all articles