Parsing Twitter API Datestamp

后端 未结 6 789
后悔当初
后悔当初 2020-12-04 22:33

I\'m using the twitter API to return a list of status updates and the times they were created. It\'s returning the creation date in the following format:

6条回答
  •  旧时难觅i
    2020-12-04 22:47

    FYI, in Java it is:

    SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss Z yyyy", Locale.ENGLISH);
    Date d = sdf.parse(dateAsString);
    
    sdf = new SimpleDateFormat("dd-MM-yyyy");
    String s = sdf.format(d);
    

提交回复
热议问题