Java Date String Format formatDateLog(String dateStr)

Here you can find the source of formatDateLog(String dateStr)

Description

Formats the date string to the string that begins with "[" and ends with "]".

License

Open Source License

Parameter

Parameter Description
dateStr a parameter

Return

a string.

Declaration

public static String formatDateLog(String dateStr) 

Method Source Code

//package com.java2s;
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt

public class Main {
    /**//from   w  ww  .java  2s . c  o m
     * Formats the date string to the string that begins with "<code>[</code>" and ends with "<code>]</code>". The
     * string of returning is like <code>[2012-5-24 11:39:22]</code>. If <code>dateStr</code> is <code>null</code>, then
     * the returned string is <code>[null]</code>.
     * 
     * @param dateStr
     * @return a string.
     */
    public static String formatDateLog(String dateStr) {
        StringBuffer sb = new StringBuffer("");
        sb.append("[");
        sb.append(dateStr);
        sb.append("]");
        return sb.toString();
    }
}

Related

  1. formatDate(String fieldName)
  2. FormatDate(String strDate, char DateSeparator)
  3. formatDate(String unformattedDate, String format)
  4. formatDate(String values)
  5. FormatDate6(String strDate)
  6. formatDateString(String dateString)
  7. FormatDateString(String dateString)
  8. formatDateToParse(String date, String errorMessage)
  9. formatDay(String date)