当前位置:网站首页>There is a problem with the date when MySQL imports and exports data to excel
There is a problem with the date when MySQL imports and exports data to excel
2022-06-25 13:15:00 【Wanghuiju】
1: Problem description
Today I was exporting sql Data time , Discovery export excel The date is wrong . The columns in the database are datetime Format , But export to excel The later date becomes the sun, month and year .
Date in database 
Export to excel Later date 
This problem leads to the import error
2: Solution
Someone on the Internet said stay excel Just change the format of the cell to date . But I used it wps, Changing the cell format doesn't really help ,
My solution , When getting the result set , Column of date , Convert to string . And then export . Use DATE_FORMAT This function
select DATE_FORMAT( Your date list ,'%Y-%m-%d %H:%i:%s') from Your watch name
It successfully solves the problem of disordered export dates .
Formatted output 
3:DATE_FORMAT Related introduction
DATE_FORMAT( Parameters 1, Parameters 2 ) There are two parameters , Parameters 1 Is your date listing , Parameters 2 Is the output formatting rule
- %Y year , Four digit number
- %y year , The last two digits
- %m month , Numbers [1-12]
- %d Japan , Day of the month , Two digits [1-31]
- %H Hours ,24 Base number [0-23]
- %h Hours ,12 Base number [0-11]
- %i minute [0-59]
- %s | %S second 0-59
边栏推荐
- Common colors for drawing
- It is extraordinary to make a move, which is very Oracle!
- 一篇文章讲清楚MySQL的聚簇/联合/覆盖索引、回表、索引下推
- 重磅直播|BizDevOps:数字化转型浪潮下的技术破局之路
- Assemble relevant knowledge points of flag bit (connected)
- Summary of leetcode linked list problem solving skills
- 《MongoDB入门教程》第01篇 MongoDB简介
- And console Log say goodbye
- Using CMD (command prompt) to install MySQL & configure the environment
- Used in time filter (EL table)
猜你喜欢

New Gospel of drug design: Tencent, together with China University of science and technology and Zhejiang University, developed an adaptive graph learning method to predict molecular interactions and

关于数据在内存中的存储下

J2EE从入门到入土01.MySQL安装

關於數據在內存中的存儲下

解析数仓lazyagg查询重写优化

Three lines of code to simply modify the project code of the jar package

剑指 Offer II 029. 排序的循环链表

剑指 Offer II 025. 链表中的两数相加

.NET in China - What's New in .NET

CUDA error: unspecified launch failure
随机推荐
关于数据在内存中存储的相关例题
Golang keyboard input statement scanln scanf code example
MySQL adds, modifies, and deletes table fields, field data types, and lengths (with various actual case statements)
Spoken English - weak reading
QT mouse tracking
It's an artifact to launch a website in a few minutes
[turn] starting from the end, analyze in detail how to fill in the college entrance examination volunteer
QT display ffmpeg decoded pictures
My first experience of go+ language -- a collection of notes on learning go+ design architecture
《MongoDB入门教程》第01篇 MongoDB简介
Include what you use to save chaotic header files
Geospatial search - > R tree index
JSTL tag: fmt:formatdate tag format Chinese standard time or timestamp
模块五(微博评论)
关于数据在内存中的存储下
mysql导入导出数据到excel表日期出现问题
Sword finger offer II 025 Adding two numbers in a linked list
解析数仓lazyagg查询重写优化
Sword finger offer 04 Find in 2D array
Module 5 (microblog comments)