Android Open Source - pdsql Date Util






From Project

Back to project page pdsql.

License

The source code is released under:

Apache License

If you think the Android project pdsql listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.piscessera.pdsql.utils;
/*from   w  w  w  .  jav  a 2  s .  co m*/
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtil {
  public static String convertFormat2StringFromString(SimpleDateFormat fmt,
      String dateString) {
    String result = "";
    try {
      Date date = fmt.parse(dateString);
      result = String.valueOf(date.getTime());
    } catch (ParseException e) {
      e.printStackTrace();
    }
    return result;
  }

  public static long convertFormat2LongFromString(SimpleDateFormat fmt,
      String dateString) {
    long result = 0L;
    try {
      Date date = fmt.parse(dateString);
      result = date.getTime();
    } catch (ParseException e) {
      e.printStackTrace();
    }
    return result;
  }

  public static long convertFormat2LongFromString(SimpleDateFormat fmt,
      Date date) {
    return convertFormat2LongFromString(fmt, String.valueOf(date.getTime()));
  }

  public static String convertFormat2StringFromString(SimpleDateFormat fmt,
      Date date) {
    return convertFormat2StringFromString(fmt,
        String.valueOf(date.getTime()));
  }
}




Java Source Code List

com.piscessera.pdsql.DatabaseContentValuesUtil.java
com.piscessera.pdsql.DatabaseCore.java
com.piscessera.pdsql.DatabaseCursorUtil.java
com.piscessera.pdsql.Dsql.java
com.piscessera.pdsql.GenericBase.java
com.piscessera.pdsql.utils.ApplicationUtil.java
com.piscessera.pdsql.utils.DateUtil.java
com.piscessera.pdsql.utils.DebugUtil.java
com.piscessera.pdsql.utils.FileUtil.java