Get Date String from Existing/Current String Date
==================
==================
public String getDateStringFromGlobalToFormatString(String strdate,String formate) { Date date = Calendar.getInstance().getTime(); if (!strdate.equalsIgnoreCase("")) { SimpleDateFormat formatCompare = new SimpleDateFormat(ConstantValues.str_appointmentStrtEndDateFormat); try { date = formatCompare.parse(strdate); } catch (ParseException e) { date = Calendar.getInstance().getTime(); e.printStackTrace(); } } SimpleDateFormat simpleDateFormat = new SimpleDateFormat(formate, Locale.getDefault()); return simpleDateFormat.format(date); }
Call
================
getDateStringFromGlobalToFormatString("","MMM dd, yyyy");
No comments:
Post a Comment