Monday 17 March 2014

Changing Date Fomat Conversion

Hi ,Use the below method to change the date format of expected date format..
\public class TimeFormat{
  
     public Calendar ConvertToCalenderFormat(String stringInstanceRepresentingDate,String Format){
               Calendar cal  = null;
           try{
               if(stringInstanceRepresentingDate!=null && !stringInstanceRepresentingDate.equalsIgnoreCase("")){
               DateFormat df = new SimpleDateFormat(Format);
                   cal  = Calendar.getInstance();
               cal.setTime(df.parse(stringInstanceRepresentingDate));
               System.out.println(cal.getTime());
               }
           }
               catch(Exception e){
                           
                              e.printStackTrace();
                              }
             
       return cal;

         
           }
     
       public String formatCalender(Calendar cal,String Formater){
          SimpleDateFormat format1 = new SimpleDateFormat(Formater);
          String formatted = format1.format(cal.getTime());
          return formatted;
       
       }
     
       public static String covnertToDateFormat(String date)
       {
         
           Calendar cal=this.ConvertToCalenderFormat(date, "yyyy-MM-dd");
           return this.formatCalender(cal, "dd/MM/yyyy");
         
         
        }
     
}
}

2 comments:

  1. Best eCOGRA Sportsbook Review & Welcome Bonus 2021 - CA
    Looking for 바카라사이트 an eCOGRA https://deccasino.com/review/merit-casino/ Sportsbook septcasino.com Bonus? At this eCOGRA Sportsbook review, we're febcasino talking about a kadangpintar variety of ECCOGRA sportsbook promotions.

    ReplyDelete