Format date without year

前端 未结 10 1525

How can create text representation of some date, that takes locale into account and contains only day and month (no year)?

Following code gives me s

10条回答
  •  伪装坚强ぢ
    2020-12-25 13:07

    This will work for Android, in case someone needs it:

    int flags = DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_NO_YEAR;
    String monthAndDayText = DateUtils.formatDateTime(context, date, flags);
    

提交回复
热议问题