android - dealing with Date and Time separately -


I want to deal with different date and time in my Android app, telling me differently, without affecting date It should be set and on the contrary, therefore, only when setting the time:

  calendar calendar = calendar.forest (); Calendar.set (calendar.click here + 1 99 0, calendar.mnat, calendar.DAY_OF_MONTH, hours, minute, 0);  

And it works perfectly, but only when setting the date:

  calendar calendar = calendar.forest (); Calendar.setTime (NEW_DATE);  

I have to face the problem of setting up at 00:00:00 , so, to save the values ​​of the first time and set the date to the following Try the way:

  calendar calendar = calendar.Ast Instance (); Calendar.setTime (NEW_DATE); Calendar.set (Calendar. YEAR + 1990 calendar, MONTH, calendar. DAY_OF_MONTH, saved_hour, saved_monits, 0);  

but it saves on the date it is saved as the default value ( calendar.YEAR || .month DAY_OF_MONTH ) returns a zero date value of the device which is a date in 1990, despite that I am excuting this order after setting a new date .

Hint : Methods ( mDate.getYear () , mDate.getMonth , ..... etc) are

You can use this code to set the date and time separately

  calendar cal = calendar.Ast Instance (); // Note: The value of the month is month number -1 (January is 0, February 1 and so on). Cal.set (Calendar. MONTH, 9); Cal.set (calendar.date, 24); Cal.set (Calendar: IEER, 2013); Cal.set (Calendar.HOUR, 1); // When it wants to set the system for 12 hours as cal.set (calendar.HOUR_OF_DAY, 13); // When it wants to set the 24-hour system cal.set (calendar.mint, 45); Cal.set (Calendar.SECOND, 52); // set to set year, month and day some more / set (int year, int month, int day) cal.set (1995, 5, 25); // set (int word, int month, int day, int bell bread, int minute, second second) cal.set (1995, 5, 25, 04, 15, 20);  

Comments