A long type is converted to a date

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.