Java Date String Format formatDay(String date)

Here you can find the source of formatDay(String date)

Description

format Day

License

Open Source License

Declaration

public static String formatDay(String date) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String formatDay(String date) {
        String result = null;//from  ww w  .  j a  v  a 2s.c  o  m

        String[] tmp = date.split("\\-");
        String year = tmp[0];
        String month = tmp[1];
        String day = tmp[2];

        if (Integer.parseInt(month) < 10) {
            month = "0" + month;
        }
        if (Integer.parseInt(day) < 10) {
            day = "0" + day;
        }

        result = year + "-" + month + "-" + day;

        return result;
    }
}

Related

  1. FormatDate6(String strDate)
  2. formatDateLog(String dateStr)
  3. formatDateString(String dateString)
  4. FormatDateString(String dateString)
  5. formatDateToParse(String date, String errorMessage)
  6. formate8Date(String str)
  7. formatIso8601ToSimpleDate(String iso8601)
  8. formatISODate(String date)
  9. formatMinDateForShowWith_(String str)