How to set the calendar in android for particular hour

后端 未结 2 565
忘了有多久
忘了有多久 2020-12-24 12:40

I dont want to add the year or month.Just the hour , minutes and seconds for each day. How to use it the Calendar object to do it ? This is my code

// get a          


        
相关标签:
2条回答
  • 2020-12-24 13:03

    try using

    calendar.set(Calendar.HOUR_OF_DAY, 4);
    calendar.set(Calendar.MINUTE, 40);
    calendar.set(Calendar.SECOND, 0);
    
    0 讨论(0)
  • 2020-12-24 13:05

    try this too

    cal.set(2013,2,7,15,42,30);
    

    Note: Months value is MonthNumber-1 (Jan is 0, Feb is 1 and so on).

    0 讨论(0)
提交回复
热议问题