--取得某天的所在周的周一的函数 CREATE FUNCTION getMondayBtDate(@date datetime) RETURNS date AS begin DECLARE @week INT,@cnt INT select @week = DATEPART(dw,@date) SET @cnt = - @week IF(@week = ) BEGIN SET @cnt = - END RETURN DATEADD(DAY, @cnt, @date) end --获取某天是当前年
function week(date,n) { var checkDate = StringToDate(date); checkDate.setDate(checkDate.getDate() + n - (checkDate.getDay() || )); return checkDate; } date:日期 n:想要返回周几,例如:周一:1,周二:2,周三:3 返回值:返回一个日期 下面的方法是返回当前日期所在周的周一对应的日期 function getMon(date) { var c
<html xmlns="http://www.w3.org/1999/xhtml" > <meta charset="UTF-8"> <head> <title>获取当年当月最后一天日期</title> <script language="javascript"> function getLastDay(){ var year = document.getElementBy