Remove time from GMT time format

前端 未结 8 2509
有刺的猬
有刺的猬 2021-02-18 23:01

I am getting a date that comes in GMT format, Fri, 18 Oct 2013 11:38:23 GMT. The problem is that the time is messing up the timeline that I am using.

How can I strip ou

8条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-18 23:41

    You can first convert the date to String:

    String dateString = String.valueOf(date);

    Then apply substring to the String:

    dateString.substring(4, 11) + dateString.substring(30);

    You need to take care as converting date to String will actually change the date format as well.

提交回复
热议问题