Example usage for java.text SimpleDateFormat format

List of usage examples for java.text SimpleDateFormat format

Introduction

In this page you can find the example usage for java.text SimpleDateFormat format.

Prototype

public final String format(Date date) 

Source Link

Document

Formats a Date into a date-time string.

Usage

From source file:Main.java

public static String formatTime(long time) {
    SimpleDateFormat format = new SimpleDateFormat("HH:mm");
    return format.format(time);
}

From source file:Main.java

public static String getFechaActual() {
    SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
    return df.format(new Date());
}

From source file:Main.java

public static String getStringDate(Date date, String format) {
    SimpleDateFormat formater = new SimpleDateFormat(format);
    return formater.format(date);
}

From source file:Main.java

public static String getHourAndMin(long time) {
    SimpleDateFormat format = new SimpleDateFormat("HH:mm");
    return format.format(new Date(time));
}

From source file:Main.java

public static String getShowTimeString(long time) {
    SimpleDateFormat format = new SimpleDateFormat("HH:mm");
    return format.format(new Date(time));
}

From source file:Main.java

public static String getCurTimeByFormat(String format) {
    Date newdate = new Date(System.currentTimeMillis());
    SimpleDateFormat sdf = new SimpleDateFormat(format);
    return sdf.format(newdate);
}

From source file:Main.java

public static String getWeekDayFromSeconds(long secs) {
    Calendar c = Calendar.getInstance();
    c.setTimeInMillis(secs * 1000L);/*from www.j a va  2  s.com*/
    SimpleDateFormat format1 = new SimpleDateFormat("E");
    return format1.format(c.getTime());
}

From source file:Main.java

public static String getTimeFormat(String format, Date date) {
    SimpleDateFormat f = new SimpleDateFormat(format);
    return f.format(date);
}

From source file:Main.java

public static String getDateDay(long time) {
    SimpleDateFormat sdf = new SimpleDateFormat("dd");
    String dt = sdf.format(time);
    return dt;//from  w  w w  .  j  a v a  2s.c o  m
}

From source file:Main.java

public static String getDateString(Date date) {
    SimpleDateFormat df = new SimpleDateFormat("E, MMM d");
    return df.format(date);
}