0

I have some things in my Android application that need to update once per Month. Everything is correct but how do I set the time?

Calendar cal = Calendar.getInstance();
 cal.add( ?, ?);

  alarmManager.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), pendingIntent);
user3103823
  • 135
  • 1
  • 3
  • 13
  • When you ask how to set the time, are you looking to set the current date and time, or are you looking to set a variable with the date and time of the update? – Phoenix Feb 24 '14 at 21:09
  • I wanted to update twenty-ninth of each month. (for example). – user3103823 Feb 24 '14 at 21:14

1 Answers1

1

See this question for getting the day of the month using Calendar()

Then, figure out what month the user is currently in using

cal.get(Calendar.MONTH_OF_YEAR)

and set your variable to the 29th of that month.

Consider February in this implementation ;)

Community
  • 1
  • 1
Phoenix
  • 1,881
  • 5
  • 20
  • 28