Here you can find the source of makePathFromDate()
public static String makePathFromDate()
//package com.java2s; /*--------------------------------------------------------------- * Copyright 2005 by the Radiological Society of North America * * This source software is released under the terms of the * RSNA Public License (http://mirc.rsna.org/rsnapubliclicense) *----------------------------------------------------------------*/ import java.io.File; import java.util.Calendar; public class Main { /**/*from www . ja va2 s . c om*/ * Make a string that defines a path from the root of the * storage service's documents tree to a specific document * directory. The path has the form: YYYY/MM/DDhhmmsssss * where the values come from the current time and the slash * character is actually either a slash or backslash, depending * on the platform. * @return the path string. */ public static String makePathFromDate() { Calendar now = Calendar.getInstance(); return intToString(now.get(Calendar.YEAR), 4) + File.separator + intToString(now.get(Calendar.MONTH) + 1, 2) + File.separator + intToString(now.get(Calendar.DAY_OF_MONTH), 2) + intToString(now.get(Calendar.HOUR_OF_DAY), 2) + intToString(now.get(Calendar.MINUTE), 2) + intToString(now.get(Calendar.SECOND), 2) + intToString(now.get(Calendar.MILLISECOND), 3); } /** * Convert a positive int to a String with at least n digits, * padding with leading zeroes. * @param theValue the int to be converted. * @param nDigits the number of digits to return. * @return the converted value. */ public static String intToString(int theValue, int nDigits) { String s = Integer.toString(theValue); int k = nDigits - s.length(); for (int i = 0; i < k; i++) s = "0" + s; return s; } }