Android Date String to Date Convert convertStandardDateTime(String time)

Here you can find the source of convertStandardDateTime(String time)

Description

convert Standard Date Time

Declaration

public static String convertStandardDateTime(String time) 

Method Source Code

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import android.widget.TextView;

public class Main{
    public static String convertStandardDateTime(String time) {
      String standardResult = "";
      try {/*from  w ww  . j  a v a  2s .co  m*/
         time = time + "000";
         long tmpTime = Long.parseLong(time);
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         standardResult = sdf.format(new Date(tmpTime));
      } catch (Exception e) {
         LogUtil.e("", e.getMessage());
      }
      return standardResult;
   }
    private static String format(int x) {
      String s = "" + x;
      if (s.length() == 1)
         s = "0" + s;
      return s;
   }
}

Related

  1. getDateFromString(String dateStr, String pattern)
  2. getDateFromString(String string)
  3. getDateObj(String argsDate, String split)
  4. getDateOffset(String date, int offset)
  5. getDateTomorrow(String date)
  6. removeTimeZone(String data)
  7. parseFileName(String timeStr)
  8. formatDate(String date)
  9. changeStringToDate(String fecha, String pattern)