iOS Calendar Access Permission Dialog, force it to appear?
Settings > General > Reset > Reset Location and Privacy
Settings > General > Reset > Reset Location and Privacy
I see mainly three ways: a) built-in options using SimpleDateFormat and DateUtils SimpleDateFormat sdf = new SimpleDateFormat(“yyyy-MM-dd’T’HH:mm:ss.SSS’Z'”); sdf.setTimeZone(TimeZone.getTimeZone(“GMT”)); try { long time = sdf.parse(“2016-01-24T16:00:00.000Z”).getTime(); long now = System.currentTimeMillis(); CharSequence ago = DateUtils.getRelativeTimeSpanString(time, now, DateUtils.MINUTE_IN_MILLIS); } catch (ParseException e) { e.printStackTrace(); } b) external library ocpsoft/PrettyTime (based on java.util.Date) Here you have to use SimpleDateFormat, too, … Read more
To save and load accurate date, you could use the long (number) representation of a Date object. Example: //getting the current time in milliseconds, and creating a Date object from it: Date date = new Date(System.currentTimeMillis()); //or simply new Date(); //converting it back to a milliseconds representation: long millis = date.getTime(); You can use this … Read more
You need to consider three points in order to add events automatically: Email Header iCalendar Method ATTENDEE information the “VEVENT” calendar component Email Header In order to get the email client to parse correctly the attached .ics file, you should add the scheduling method and MIME information to the email headers. This is specified by … Read more
You don’t need to count every day in the month. You already know the first 28 days contain 20 weekdays no matter what. All you have to do is determine the last few days. Change the start value to 29. Then add 20 weekdays to your return value. function get_weekdays($m,$y) { $lastday = date(“t”,mktime(0,0,0,$m,1,$y)); $weekdays=0; … Read more
Quick one liner: Integer weeksOfYear = Calendar.getInstance().getActualMaximum(Calendar.WEEK_OF_YEAR);
Since the accepted answer still uses the obsolete Calendar class – here’s my two cents using the newer Java Date and Time API available in the java.time package. You have to get the dates of the holidays from somewhere, there is no standard Java library for it. That would be too localized anyway, since holidays … Read more
java.time.YearMonth methods atDay & atEndOfMonth The java.time framework built into Java 8+ (Tutorial) has commands for this. The aptly-named YearMonth class represents a month of a year, without any specific day or time. From there we can ask for the first and days of the month. YearMonth yearMonth = YearMonth.of( 2015, 1 ); // 2015-01. … Read more
I use the following: from pandas.tseries.offsets import BMonthEnd from datetime import date d=date.today() offset = BMonthEnd() #Last day of current month offset.rollforward(d) #Last day of previous month offset.rollback(d)
You could change the check of the week so the function would read: private bool NthDayOfMonth(DateTime date, DayOfWeek dow, int n){ int d = date.Day; return date.DayOfWeek == dow && (d-1)/7 == (n-1); } Other than that, it looks pretty good and efficient.