Here you can find the source of FormatDate(String strDate, char DateSeparator)
Parameter | Description |
---|---|
strDate | a parameter |
DateSeparator | a parameter |
public static String FormatDate(String strDate, char DateSeparator)
//package com.java2s; //License from project: Open Source License public class Main { public static String FormatDate(String strDate, char DateSeparator) { String strOutDate;//from www.j a v a2 s.c om int Len; Len = strDate.length(); if ((Len != 6) && (Len != 8)) strOutDate = strDate; else { if (Len == 6) { strDate = strDate.substring(0, 2) + DateSeparator + strDate.substring(2, 4) + DateSeparator + strDate.substring(4); strOutDate = strDate; } else { strDate = strDate.substring(0, 4) + DateSeparator + strDate.substring(4, 6) + DateSeparator + strDate.substring(6); strOutDate = strDate; strOutDate = strDate; } } return strOutDate; } }