Java SQL Date Get getDatePath(java.util.Date fileDate)

Here you can find the source of getDatePath(java.util.Date fileDate)

Description

Returns a directory structure based on the date supplied

License

Open Source License

Parameter

Parameter Description
fileDate Description of the Parameter

Return

The datePath value

Declaration

public static String getDatePath(java.util.Date fileDate) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.text.SimpleDateFormat;

public class Main {
    /**/* www  .j a v a2  s. co m*/
     *  Returns a directory structure based on the date supplied
     *
     * @param  fileDate  Description of the Parameter
     * @return           The datePath value
     */
    public static String getDatePath(java.util.Date fileDate) {
        return getDatePath(new java.sql.Timestamp(fileDate.getTime()));
    }

    /**
     *  Returns a directory structure based on the timestamp supplied, used for
     *  the fileLibrary: yyyy/MMdd/
     *
     * @param  fileDate  Description of Parameter
     * @return           The DatePath value
     */
    public static String getDatePath(java.sql.Timestamp fileDate) {
        if (fileDate == null) {
            return "0000" + System.getProperty("file.separator") + "0000" + System.getProperty("file.separator");
        }
        SimpleDateFormat formatter1 = new SimpleDateFormat("yyyy");
        String datePathToUse1 = formatter1.format(fileDate);
        SimpleDateFormat formatter2 = new SimpleDateFormat("MMdd");
        String datePathToUse2 = formatter2.format(fileDate);
        return datePathToUse1 + System.getProperty("file.separator") + datePathToUse2
                + System.getProperty("file.separator");
    }
}

Related

  1. getDateOfShortStr(String dateStr)
  2. getDateOfString(long time, String patten)
  3. getDateOrTime(int colType, Object o)
  4. getDateParameter(java.sql.Date date, int param)
  5. getDatePath(java.sql.Timestamp fileDate)
  6. getDateStart(Date date)
  7. getDateTwo(Date date)
  8. getDateValue(ResultSet result, String strField, String strDateFormat)
  9. getDateValue(ResultSet result, String strField, String strDateFormat)