Set Alarms to Specific Date and Time in Android
<p>Please kindly have a look at this. I am trying to set an alarm for a specific time and date. It does not seem to be working and i don't really know why. </p>

<pre><code>             Calendar cal = Calendar.getInstance();

         cal.setTimeInMillis(System.currentTimeMillis());
         cal.set(Calendar.YEAR, mYear);
         cal.set(Calendar.MONTH,mMonth);
         cal.set(Calendar.DAY_OF_MONTH,mDay);
         cal.set(Calendar.HOUR,mHour);
         cal.set(Calendar.MINUTE,mMinutes);

// where mYear, mMonths, mDay, mHour and mMinutes are int values from the Date and Time picker dialogs respectively

     Intent activate = new Intent(this, Alarm.class);
     PendingIntent alarmIntent = PendingIntent.getBroadcast(this, 0, activate, 0);
     alarms = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
     alarms.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), alarmIntent);
</code></pre>

<p>just to let you know, it works if i replace the cal.getTimeInMillis() with System.CurrentTimeInMillis() in the alarms.set() methods.  But thats obviously what i don't want. Thanks    </p>
