How to get the day, year, hours, min Individually from date format “yyyy-MM-dd'T'HH:mm:ss.SSSZ”?

后端 未结 4 1972
忘了有多久
忘了有多久 2020-12-15 21:00

I am doing a programme that stores the present time and date in \"yyyy-MM-dd\'T\'HH:mm:ss.SSSZ\" this format. and I am storing it in database as a string. when

4条回答
  •  南笙
    南笙 (楼主)
    2020-12-15 21:15

    Try using : int hour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY);

    Here,

    • Calendar.HOUR_OF_DAY gives you the 24-hour time.
    • Calendar.HOUR gives you the 12-hour time.

提交回复
热议问题