SELECT UNIX_TIMESTAMP(NOW());
将数据库表中字段类型是DateTime,写sql保存时将当前时间转成Date类型的保存,注意System.currentTimeMills是毫秒,New Date()的参数一定要是毫秒
new Date(System.currentTimeMillis())
SELECT UNIX_TIMESTAMP(NOW());将数据库表中字段类型是DateTime,写sql保存时将当前时间转成Date类型的保存,注意System.currentTimeMills是毫秒,New Date()的参数一定要是毫秒new Date(System.currentTimeMillis())
select
date
_format(now(),'%y-%m-%d');
根据format字符串格式化
date
值:
%S, %s 两
位
数字形式的秒( 00,01, …, 59)
%I, %i 两
位
数字形式的分( 00,01, …, 59)
%H 两
位
数字形式的小时,24 小时(
long nowtime=Long.parseLong("157
10
68800000"); //13
位
时间戳
;
Date
date
=new
Date
(nowtime); //
10
位
时间戳
需要*
10
00
Simple
Date
Format format=new Simple
Date
Format("yyyy-MM-dd");
String now
Date
S...
前面有讲过存日期
时间
可以用
date
time、timestamp 类型:https://www.cnblogs.com/poloyy/p/15546735.html
格式是:YYYY-MM-DD hh:mm:ss
但假设我不想存具体的日期
时间
,想存一个 unix
时间戳
呢?
啥是 unix
时间戳
可以去这个网站看看就知道了,http://tool.chinaz.com/Too...
使用函数:Now,current_timestamp,unix_timestamp
SELECT NOW(),NOW(3),NOW(6),current_timestamp(),current_timestamp(6)
,unix_timestamp(current_timestamp(3)),REPLACE(unix_timestamp(current_timestamp(3)),'.',''),unix_timestamp(current_timestamp(3))*
10
00SELECT NOW(),
回忆是昨天里的海: