List of utility methods to do Day Convert To
int | day2doy(int year, int month, int mday) Convert Day of Month to Day of Year. int[] regu_month_day = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 }; int[] leap_month_day = { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335 }; int yday = 0; if ((year % 4) == 0) { yday = leap_month_day[month - 1] + mday; } else { yday = regu_month_day[month - 1] + mday; return yday; |
long | day2msec(int day) converts day to millisecond return hour2msec(day * 24);
|
String | day2String(int dayofweek) Examine an int and determine if it is a day of the week. String result = "Sunday"; if (dayofweek == 1) { result = "Sunday"; } else if (dayofweek == 2) { result = "Monday"; } else if (dayofweek == 3) { result = "Tuesday"; } else if (dayofweek == 4) { ... |
long | daysToSecs(long days) days To Secs return hoursToSecs(days * HOURS_IN_DAY);
|
int | daysToTicks(double x) D&D days to ticks (5 hours per MC 'day') return hoursToTicks(x * HOUR_PER_DAY);
|
String | daysToYears(int days) days To Years int years = days / 365; int leftOvers = days - (years * 365); String total = String.valueOf(years) + ":" + String.valueOf(leftOvers); return total; |