From ThinkPrank Wiki
Jump to: navigation, search

Date Functions

  public class DateTest {
	public static String getProcessDateMM(String f) {
		SimpleDateFormat dateFormat = new SimpleDateFormat(f);
		StringBuffer buf = new StringBuffer();
		return dateFormat.format(new Date(), buf, new FieldPosition(0)).toString();
	public static void main(String[]args){
		System.out.println("Date: MM-dd-yyyy: "+getProcessDateMM("MM-dd-yyyy"));
		System.out.println("Date: MM: "+getProcessDateMM("MM"));
		System.out.println("Date: Day of month: dd: "+getProcessDateMM("dd"));
		System.out.println("Date: Day of year: DD: "+getProcessDateMM("DD"));
		System.out.println("Date: yyyy: "+getProcessDateMM("yyyy"));
Personal tools