惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hacker News: Front Page
P
Palo Alto Networks Blog
T
ThreatConnect
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
T
True Tiger Recordings
P
Privacy & Cybersecurity Law Blog
B
Blog
IT之家
IT之家
Last Week in AI
Last Week in AI
F
Full Disclosure
Hacker News: Ask HN
Hacker News: Ask HN
C
Comments on: Blog
Microsoft Azure Blog
Microsoft Azure Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
N
News and Events Feed by Topic
NISL@THU
NISL@THU
腾讯CDC
雷峰网
雷峰网
Security Latest
Security Latest
李成银的技术随笔
M
Microsoft Research Blog - Microsoft Research
L
LangChain Blog
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Check Point Blog
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
博客园 - Franky
N
News | PayPal Newsroom
V
V2EX
A
About on SuperTechFans
The Register - Security
The Register - Security
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google Online Security Blog
Google Online Security Blog
MyScale Blog
MyScale Blog
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
WordPress大学
WordPress大学
C
Cyber Attacks, Cyber Crime and Cyber Security
The Hacker News
The Hacker News
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
爱范儿
爱范儿
A
Arctic Wolf
L
LINUX DO - 最新话题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

博客园 - lui

阿里云SSL证书到期(续期)图文教程 IIS7配置HTTPS+默认访问https路径 SQL将多行数据合并成一行【转】 arcgis 服务网页打开需要输入用户名和密码问题解决 Arcgis for js加载百度地图 android-studio-ide 安装到运行第一个helloword,坑记录 Hyper-V虚拟机联网设置 arcgis--arcmap导出点的X,Y坐标 mysql查看锁表与解锁 arcgis10.2怎么把地理坐标系转化为投影坐标系(平面,米制坐标) arcmap 10.2 从 WGS_1984 转 Beijing_1954 【win10系统问题】远程桌面登录一次后,第二次登录看不到用户名和密码输入框 如何更改Arcmap里经纬度小数点后面的位数? 腾讯视频qlv格式转换MP4普通视频方法 kettle_Spoon 修改共享DB连接带汉字引发的错误 AutoCAD2015激活码和密钥 SQL获取本周,上周,本月,上月第一天和最后一天[注:本周从周一到周天] SQL语句 不足位数补0 c# winform 服务器提交了协议冲突. Section=ResponseStatusLine java.net.ProtocolException: Server redirected too many times - lui
mysql 转换13位数字毫秒时间
lui · 2018-11-05 · via 博客园 - lui

MySQL毫秒值和日期转换,MYSQL内置函数FROM_UNIXTIME:

select FROM_UNIXTIME(t.createDate/1000,'%Y-%m-%d %h:%i:%s') as cd from task t where taskStatus='1';

SELECT FROM_UNIXTIME(time/1000,'%Y-%m-%d %h:%i:%s')  FROM `logs` where time='1541260863000';

//t.createDate里是long类型的1465375837873数据,记录从1970年1月1日到现在的毫秒数。

其中unix_timestamp为字段值/1000.

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), 这里星期一是星期的第一天

%% 一个文字“%”。

返回从1970年1月1日到定时间的毫秒数

select UNIX_TIMESTAMP('2017-06-12 12:00:05')*1000;

//UNIX_TIMESTAMP该函数只返回1970。。。。到现在的秒数。如果算上一个函数一样是毫秒数,则还需要乘以1000