获取当前时间 func Now func Now() Time 1 Now returns the current local time. func (Time) UTC func (t Time) UTC() Time 1 UTC returns t with the location set to UTC. func (Time) Unix func (t Time) Unix() int64 1 Unix returns t as a Unix time, the number of se
1.Datepart() 返回代表指定日期的指定日期部分的整数 语法 Datepart(datepart,date) 返回类型 int datepart: 日期部分 缩写 year yy, yyyy quarter qq, q month mm, m dayofyear dy, y day dd, d week wk, ww weekday dw日期部分返回对应于星期中的某天的数,例如:Sunday =1 Hour hh minute mi, n second ss, s millisecond
1.查询当前日期和时间 select sysdate from dual; 2.查询本月最后一天 select last_day(sysdate) from dual; 3.查询前后多少月 ) from dual; 4.查询下一周的星期几的具体日期(周日-周六:1-7) ) from dual; 5.时间转时间 select to_char(sysdate,'YYYY-MM-DD HH:MI:SS') from dual; 6.字符转时间 ','YYYY-MM-DD') from dual; 7
SQL计算时间差并排除周末 CREATE FUNCTION DI_FN_GET_WorkDay (@begin DATETIME , @end DATETIME ) RETURNS int BEGIN IF @end > @begin BEGIN , ) END END ) ), ) AS DATETIME), @begin) ), , ) AS DATETIME)) RETURN @j END sql 计算结束时间 去除周六周末, SQL里dateadd计算日期时跳过周六周日两天计算日期