Java Date String Format FormatDate(String aDate)

Here you can find the source of FormatDate(String aDate)

Description

Change the separator of the date

License

Apache License

Parameter

Parameter Description
aDate string, format: %s.%s.%s

Return

%s-%s-%s

Declaration

public static String FormatDate(String aDate) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    /**/*from  ww  w.j  a  v a  2s .  co m*/
      * Change the separator of the date
      * @param aDate string, format: %s.%s.%s
      * @return %s-%s-%s
      */
    public static String FormatDate(String aDate) {
        String[] lParts = aDate.split("\\.", 0);
        return String.format("%s-%s-%s", lParts[0], lParts[1], lParts[2]);
    }
}

Related

  1. dateFormatFix(String str)
  2. formatDate(byte[] btValue, int iOffset, int iLength)
  3. formatDate(int year, int month, int day)
  4. formatDate(Integer date)
  5. formatDate(Integer day, Integer month, Integer year)
  6. formatDate(String date)
  7. formatDate(String date)
  8. formatDate(String date)
  9. formatDate(String date)