-
-
Notifications
You must be signed in to change notification settings - Fork 708
Tutorials)
public static int getWeekday(int year, int month, int day) { // 验证输入合法性 int[] MonthDays = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; if (((year % 4 == 0) && (year % 100 != 0)) || year % 400 == 0) { MonthDays[1] = 29; } if (year < 0 || month < 0 || day < 0) { return 0; } if (year > 10000) { return -1; } else if (month > 12) { return -2; } else if (day > MonthDays[month - 1]) { return -3; } // 开始计算 int totalDays = 0; for (int i = 1; i < year; i++) { if (((i % 4 == 0) && (i % 100 != 0)) || i % 400 == 0) { totalDays += 366; } else { totalDays += 365; } } for (int i = 1; i < month; i++) { if (i == 2) { if (((year % 4 == 0) && (year % 100 != 0)) || year % 400 == 0) { MonthDays[1] = 29; } } totalDays += MonthDays[i - 1]; } totalDays += day; int tempDay = totalDays % 7; if (tempDay == 0) { tempDay = 7; } return tempDay; }
Also check out Soot's webpage.
NOTE: If you find any bugs in those tutorials (or other parts of Soot) please help us out by reporting them in our issue tracker.
- Home
- Getting Help
- Tutorials
- Reference Material
- General Notions
- Getting Started
- A Few Uses of Soot
- Using Soot as a Command-Line Tool
- Using the Soot Eclipse Plugin
- Using Soot as a Compiler Framework
- Building Soot
- Coding Conventions
- Contributing to Soot
- Updating the Soot Web Page
- Reporting Bugs
- Preparing a New Soot Release