格式化MYSQL时间戳函数FROM_UNIXTIME_MySQL
unix时间戳
对MYSQL没有进行过深入的研究,基础知识匮乏,一遇到问题只能手册,看来要把MYSQL的学习安排进时间表了。
函数:FROM_UNIXTIME
作用:将MYSQL中以INT(11)存储的时间以"YYYY-MM-DD"格式来显示。
语法:FROM_UNIXTIME(unix_timestamp,format)
返回表示 Unix 时间标记的一个字符串,根据format字符串格式化。format可以包含与DATE_FORMAT()函数列出的条目同样的修饰符。
根据format字符串格式化date值。
下列修饰符可以被用在format字符串中:
%M 月名字(January……December)
%W 星期名字(Sunday……Saturday)
%D 有英语前缀的月份的日期(1st, 2nd, 3rd, 等等。)
%Y 年, 数字, 4 位
%y 年, 数字, 2 位
%a 缩写的星期名字(Sun……Sat)
%d 月份中的天数, 数字(00……31)
%e 月份中的天数, 数字(0……31)
%m 月, 数字(01……12)
%c 月, 数字(1……12)
%b 缩写的月份名字(Jan……Dec)
%j 一年中的天数(001……366)
%H 小时(00……23)
%k 小时(0……23)
%h 小时(01……12)
%I 小时(01……12)
%l 小时(1……12)
%i 分钟, 数字(00……59)
%r 时间,12 小时(hh:mm:ss [AP]M)
%T 时间,24 小时(hh:mm:ss)
%S 秒(00……59)
%s 秒(00……59)
%p AM或PM
%w 一个星期中的天数(0=Sunday ……6=Saturday )
%U 星期(0……52), 这里星期天是星期的第一天
%u 星期(0……52), 这里星期一是星期的第一天
%% 一个文字“%”。
例子:
SELECT FROM_UNIXTIME(1234567890, '%Y-%m-%d %H:%i:%S')
SELECT *,FROM_UNIXTIME(created, '%Y-%m-%d') as riqi FROM `rc_ms_users`

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Our computer screens emit blue light, just like the light from the sun. This light is not that harmful. But on other nights when the lighting is slightly warmer, you'll eventually experience eye strain as you stare at the brighter blue light emitting from your computer screen for longer. Of course, you probably know all of this, and you probably already know about the night light feature that your windows have, which helps block the emission of blue light and instead uses warmer colors that are pleasant to your eyes. You've probably turned this feature on every time you feel like your eyes are burning too. But did you know you can set a schedule that automatically enables and disables the night light feature? If you don’t know yet, keep reading! Step 1: To launch the Settings app, press WIN+ simultaneously

The schedule function in Han Xiaoquan, a social app, can be said to be good news for video lovers. It is specially designed to help friends keep abreast of video content updates to ensure that you will not miss any exciting moments. However, some friends don’t know much about the specific location and viewing method of this function. So this article will introduce the update schedule position of Han Xiaoquan in detail, hoping to help everyone in need. Where is the timetable for Han Xiaoquan? 1. First open the Han Xiaoquan app and click in the lower left corner. 2. Then find and click on the left. 3. Finally, select the time you want to view, and you can see what content will be updated on that day.

MySQL is an open source relational database management system that is widely used in web application development and data storage. Learning MySQL's SQL language is very necessary for data managers and developers. SQL language is the core part of MySQL, so before learning MySQL, you need to have a full understanding of SQL language. This article aims to explain the basic knowledge of SQL statements to you in detail, so that you can understand SQL statements step by step. SQL is the abbreviation of Structured Query Language, which is used in relational data

Starting from Scratch: Introduction to the Basics of Learning Go Language Go language, also known as Golang, is an open source programming language developed by Google. It was released in 2009 and quickly became a popular language, especially in fields such as web development, distributed systems, and cloud computing. The Go language is famous for its simplicity, efficiency, and strong concurrency. Basic syntax 1. Variables and constants In the Go language, variables and constants are typed. Variables can store data, while constants cannot be changed. The declaration format of variables is: v

What basic knowledge do you need to learn canvas? With the development of modern web technology, using the <canvas> tag in HTML5 for drawing has become a common way. Canvas is an HTML element used to draw graphics, animations and other images, which can be manipulated and controlled using JavaScript. If you want to learn canvas and master its basic knowledge, the following will introduce it to you in detail. HTML and CSS basics: before learning canvas

Yii is a popular object-oriented PHP framework. Its full name is "YesItIs", which means "Yes, it is like this". It is designed to be efficient, fast, secure and easy to use, so it is widely used in the development of large-scale web applications. In this article, we will introduce some basic knowledge of Yii framework to help novices better understand this framework. MVC architecture Yii framework adopts a design pattern based on MVC (Model-View-Controller), which

Quick Start Go Language Programming: Basic Knowledge and Practice Guide Go language, as an emerging programming language, is favored by developers for its simplicity, efficiency and concurrency. Whether you are a beginner or a developer with some programming experience, this article will take you quickly into Go programming and provide some practical guidelines and specific code examples. 1. Install the Go language environment. To start programming in the Go language, you first need to install the Go language environment on your computer. You can download it from Go official website (https://golang

"In-depth Discussion on the Basics of Go Language Programming: Analysis of Specific Code Examples" As a fast and efficient programming language, Go language is increasingly favored by programmers and developers. In the process of learning and mastering the Go language, it is crucial to have a deep understanding of its basics. This article will conduct an in-depth discussion on variables, data types, process control, functions, etc., and combine it with specific code examples to help readers better understand and master the basic knowledge of the Go language. Variables and data types In Go language, the declaration and initialization of variables are very
