yyyy-MM-dd HH:mm:ss
new Date()
// SimpleDateFormat是线程不安全的, DateTimeFormatter是线程安全的
new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())
new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse("2022-10-10 14:14:14")
LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))
LocalDateTime.parse("2022-10-10 14:14:14", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))
Python
%Y-%m-%d %H:%M:%S
datetime.now()
datetime.strftime(datetime.now(),"%Y-%m-%d %H:%M:%S")
datetime.strptime("2022-10-10 14:14:14", "%Y-%m-%d %H:%M:%S")
Linux
+%Y-%m-%d %H:%M:%S
date "+%Y-%m-%d %H:%M:%S"
date -d "2022-10-10 14:14:14"
MySQL
%Y-%m-%d %H:%i:%s
select now()
select date_format(now(),'%Y-%m-%d %H:%i:%s')
select str_to_date('2022-10-10 14:14:14','%Y-%m-%d %H:%i:%s')
Oracle
YYYY-MM-DD HH24:MI:SS
select sysdate from dual
select TO_CHAR(sysdate, 'YYYY-MM-DD HH24:MI:SS') from dual
select TO_DATE("2022-10-10 12:12:12", 'YYYY-MM-DD HH24:MI:SS') from dual