Here you can find the source of getDatePath(java.util.Date fileDate)
Parameter | Description |
---|---|
fileDate | Description of the Parameter |
public static String getDatePath(java.util.Date fileDate)
//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"); } }