Split date/time strings

后端 未结 7 1859
不思量自难忘°
不思量自难忘° 2020-12-18 03:32

I have a ReST service which downloads information about events in a persons calendar...

When it returns the date and time, it returns them as a string

e.g. d

7条回答
  •  伪装坚强ぢ
    2020-12-18 03:46

    Assuming you get your date in String format (if not, convert it!) and then this:

    String date = "12/8/2012";
    String[] dateParts = date.split("/");
    String day = dateParts[0]; 
    String month = dateParts[1]; 
    

    Similarly u can split time as well!

提交回复
热议问题