一,代码. #import "ViewController.h" @interface ViewController () @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. NSLog(@"8月的天数%ld",(lo
js如何获取一个月的天数 function days(year,month){ var dayCount; now = new Date(year,month, 0); dayCount = now.getDate(); return dayCount; } alert(days(2014,7)) javascript获取一个月的天数
方法1 /** * 获取某年月的天数 * @param year 年 * @param month 月(0-11) * @returns {number} 天数 */ var getDaysOfMonth = function (year, month) { month = month + 1; switch (month) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: return 31; case 4: case 6:
---注意:这里统计的周末包括周5,周6,但不包括周日ALTER FUNCTION [dbo].[GetWeekDaysByMonth] ( @Year INT, @Month INT, @Day INT ) RETURNS INT AS BEGIN ); , , , ; , , , ), , , )) ); --月天数 ; BEGIN ;---周几 END; ELSE BEGIN SET @weekday = DATEPART(WEEKDAY, @date);---周几 END; BEGIN
/*** 方法一*/ String strDate = "2012-02"; SimpleDateFormat format = new SimpleDateFormat("yyyy-MM"); Date date = format.parse(strDate); Calendar calendar = new GregorianCalendar(); calendar.setTime(date); int days1 = calendar.getActualMax
import java.text.SimpleDateFormat; import java.util.Calendar; public class Test { public static void main(String[] args) { //获取当前时间 Calendar cal = Calendar.getInstance(); //下面可以设置月份,注:月份设置要减1,所以设置1月就是1-1,设置2月就是2-1,如此类推 cal.set(Calendar.MONTH, 1-1); /