Package com.xcfh.util;
Import Java.sql.Date;
Import Java.text.SimpleDateFormat;
/**
* @Description: Long turns into time
*
* @author Pinetree
* @version 2.0
* 2014-11-24
*/
public class Longtodate {
/**
* @Description: String type of milliseconds converted to date
*
* @param lo Number of milliseconds
* @return String YYYY-MM-DD HH:mm:ss
*/
public static string Stringtodate (String lo) {
Long time = Long.parselong (LO);
Date date = new Date (time);
SimpleDateFormat sd = new SimpleDateFormat ("Yyyy-mm-dd HH:mm:ss");
return Sd.format (date);
}
/**
* @Description: Long type converted to date
*
* @param lo Number of milliseconds
* @return String YYYY-MM-DD HH:mm:ss
*/
public static String longtodate (long lo) {
Date date = new Date (LO);
SimpleDateFormat sd = new SimpleDateFormat ("Yyyy-mm-dd HH:mm:ss");
return Sd.format (date);
}
/**
* @Description: A long type produces unsigned date formats
*
* @param lo Date milliseconds
* @return String YYYYMMDDHHMMSS
*/
public static String getlongtodate (long lo) {
Date date = new Date (LO);
SimpleDateFormat sd = new SimpleDateFormat ("Yyyymmddhhmmss");
return Sd.format (date);
}
/**
* @Description: String type produces unsigned date formats
*
* @param lo Date milliseconds (in string form)
* @return String YYYYMMDDHHMMSS
*/
public static string Getstringtodate (String lo) {
Long time = Long.parselong (LO);
Date date = new Date (time);
SimpleDateFormat sd = new SimpleDateFormat ("Yyyymmddhhmmss");
return Sd.format (date);
}
/**
* @Description: A long type is converted into a date format in point form
*
* @param lo Date milliseconds
* @return String yyyy. Mm.dd
*/
public static String getlongpointdate (long lo) {
Date date = new Date (LO);
SimpleDateFormat sd = new SimpleDateFormat ("yyyy. Mm.dd ");
return Sd.format (date);
}
/**
* @Description: String type is converted to a point form of a date format
*
* @param lo String type date millisecond number
* @return String yyyy. Mm.dd
*/
public static string Getstringpointdate (String lo) {
Long time = Long.parselong (LO);
Date date = new Date (time);
SimpleDateFormat sd = new SimpleDateFormat ("yyyy. Mm.dd ");
return Sd.format (date);
}
/**
* @Description: A long type is converted to a date format
*
* @param lo Long type date good contempt
* @return String YYYYMMDD
*/
public static String getlotodate (long lo) {
Date date = new Date (LO);
SimpleDateFormat sd = new SimpleDateFormat ("YyyyMMdd");
return Sd.format (date);
}
/**
* @Description: String type turns into date format
*
* @param lo String type date good contempt
* @return String YYYYMMDD
*/
public static string Getstrtodate (String lo) {
Long time = Long.parselong (LO);
Date date = new Date (time);
SimpleDateFormat sd = new SimpleDateFormat ("YyyyMMdd");
return Sd.format (date);
}
/**
* @Description: A long type is converted into a date format in point form
*
* @param lo Date milliseconds
* @return String yyyy. Mm.dd HH:mm:ss
*/
public static String longpointdate (long lo) {
Date date = new Date (LO);
SimpleDateFormat sd = new SimpleDateFormat ("yyyy. Mm.dd HH:mm:ss ");
return Sd.format (date);
}
/**
* @Description: String type is converted to a point form of a date format
*
* @param lo String type date millisecond number
* @return String yyyy. Mm.dd HH:mm:ss
*/
public static string Stringpointdate (String lo) {
Long time = Long.parselong (LO);
Date date = new Date (time);
SimpleDateFormat sd = new SimpleDateFormat ("yyyy. Mm.dd HH:mm:ss ");
return Sd.format (date);
}
}
A long type is converted to a date