1.日期和字符转换函数用法(to_date,to_char)select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') as nowTime from dual; //日期转化为字符串 select to_char(sysdate,'yyyy') as nowYear from dual; //获取时间的年 select to_char(sysdate,'mm') as nowMonth from dual; //获取时间的月 select to_char(s…
js获取时间函数 var myDate = new Date; var year = myDate.getFullYear();//获取当前年 var yue = myDate.getMonth()+1;//获取当前月 var date = myDate.getDate();//获取当前日 var h = myDate.getHours();//获取当前小时数(0-23) var m = myDate.getMinutes();//获取当前分钟数(0-59) var s = myDate.get…
mysql数据库获取年龄:TIMESTAMPDIFF(YEAR, [出生日期字段], CURDATE()) select * from (select name 姓名,TIMESTAMPDIFF(YEAR, [出生日期字段], CURDATE()) 年龄 from [表名] )a; sqlserver数据库获取年龄:DATEDIFF(yy,[出生日期字段],GETDATE()) select id AS 编号,SStudentName AS 姓名,DATEDIFF(yy,[出生日期字段],G…