/*** Turn the date to uppercase * For example: 2013-05-13 to May 13, 2013 *@paramDate *@return */ Public Staticstring Getdxdate (string date) {string datearr[]= Date.split ("-"); String Year= Datearr[0]; String Month= Datearr[1]; String Day= Datearr[2]; StringBuilder SB=NewStringBuilder (); Map<String,String> map =NewHashmap<string,string>(); Map.put ("0", "0"); Map.put ("1", "one"); Map.put ("2", "two"); Map.put ("3", "three"); Map.put ("4", "four"); Map.put ("5", "Five"); Map.put ("6", "six"); Map.put ("7", "Seven"); Map.put ("8", "eight"); Map.put ("9", "Nine"); Map.put ("10", "Ten"); //processing Year Char[] Yeararr =Year.tochararray (); for(inti=0;i<4;i++) {sb.append (Map.get (""+yeararr[i])); } sb.append (Years); //Processing Month intm =Integer.parseint (month); if(m>10){ Char[] Montharr =Month.tochararray (); Sb.append ("Ten"). Append (Map.get ("" +montharr[1])); }Else{sb.append (Map.get (""+m)); } sb.append (Months); //Processing Day intD =Integer.parseint (day); if(d>10){ if(d==20) {sb.append ("20"); }Else if(d==30) {sb.append ("30"); }Else{ Char[] Dayarr =Day.tochararray (); Switch(dayarr[0]){ Case' 1 ': Sb.append (Ten); Break; Case' 2 ': Sb.append ("20"); Break; Case' 3 ': Sb.append ("30"); Break; } sb.append (Map.get ("" +dayarr[1])); } }Else{sb.append (Map.get (""+d)); } sb.append (Day); returnsb.tostring (); }
Public Static void Main (string[] args) { = getdxdate ("2014-02-28"); System.out.println ("==result:" +result); }
run:==0 seconds)
Convert date yyyy-mm-dd to digital capitalization