Java Utililty Methods Hour Format

List of utility methods to do Hour Format

Description

The list of methods to do Hour Format are organized into topic(s).

Method

longformatStringTimeToLong(String timeLine)
format String Time To Long
long time = -1L;
SimpleDateFormat format = new SimpleDateFormat(FROMAT);
try {
    time = format.parse(timeLine).getTime();
} catch (ParseException e) {
    e.printStackTrace();
return time;
...
java.util.DateformatStrToDate(String strDate, int format)
format Str To Date
java.util.Date rel = null;
if (strDate != null && !strDate.equals("")) {
    if (format >= DATE_FORMATTER.length || format < 0) {
        format = 0;
    try {
        rel = DATE_FORMATTER[format].parse(strDate);
    } catch (ParseException e) {
...
java.util.DateformatStrToDate(String value, String pattern)
format Str To Date
java.text.SimpleDateFormat format = null;
if (null == pattern) {
    format = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
} else {
    format = new java.text.SimpleDateFormat(pattern);
try {
    return format.parse(value);
...
StringformattedDate()
formatted Date
return toTimestamp(new Date());
StringformattedDate(java.util.Date date, String formatString)
Formats the System date in the order determined by the formatString
SimpleDateFormat format;
format = (SimpleDateFormat) formats.get(formatString);
if (format == null) {
    format = new SimpleDateFormat(formatString);
    formats.put(formatString, format);
return format.format(date);
java.util.DateformattedDateToDate(String str)
Returns a Date object parsed from the date-time string formatted in accordance with RFC 822.
java.text.SimpleDateFormat df = new java.text.SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z",
        java.util.Locale.US);
java.text.ParsePosition pos = new java.text.ParsePosition(0);
try {
    return (df.parse(str, pos));
} catch (Exception ignore) {
    return (null);
DateformattedStringToDate(String date)
Converts a String that represents a Date with the format of DATEPATTERN into a Date-Object
SimpleDateFormat formatter = new SimpleDateFormat(DATEPATTERN);
try {
    return formatter.parse(date);
} catch (ParseException e) {
    e.printStackTrace();
    return null;
StringformattedTime(long epochTime)
Member Functions
return siriDateTimeFormat.format(new Date(epochTime));
StringformattedTimeForFilenames()
formatted Time For Filenames
SimpleDateFormat sdf = new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss");
return sdf.format(new Date());
StringformatterDate(Date date, byte format)
This method formats a date using the Brazilian convention
if (date == null) {
    return "";
SimpleDateFormat simpleDateFormat;
switch (format) {
case 1:
    simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss");
    break;
...