1 /* 2 * This file is a part of CAST project. 3 * (c) Copyright 2007, AGH University of Science & Technology 4 * https://caribou.iisg.agh.edu.pl/trac/cast 5 * 6 * Licensed under the Eclipse Public License, Version 1.0 (the "License"). 7 * You may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * http://www.eclipse.org/legal/epl-v10.html 10 */ 11 /* 12 * File: ReadableDateFactory.java 13 * Created: 2007-00-00 14 * Author: klewandowski 15 * $Id: ReadableDateFactory.java 2306 2009-01-12 21:38:39Z tmilos $ 16 */ 17 18 package pl.edu.agh.cast.util; 19 20 import java.text.SimpleDateFormat; 21 import java.util.Date; 22 23 /** 24 * Class working as a factory providing nicely formated dates. 25 * 26 * @author AGH CAST Team 27 */ 28 public final class ReadableDateFactory { 29 30 private static SimpleDateFormat simpleDateFormat = new SimpleDateFormat(Messages.ReadableDateFactory_Format); 31 32 private ReadableDateFactory() { 33 } 34 35 /** 36 * Get current date in a nice, internationalized format. 37 * 38 * @return Date as string. 39 */ 40 public static String getReadableDate() { 41 return simpleDateFormat.format(new Date()); 42 } 43 44 /** 45 * Get a date in a nice, internationalized format. 46 * 47 * @param d 48 * date to return 49 * @return internationalized string representation of the date 50 */ 51 public static String getReadableDate(Date d) { 52 return simpleDateFormat.format(d); 53 } 54 55 }