1 // Copyright (c) 2003-2007, Jodd Team (jodd.sf.net). All Rights Reserved. 2 3 package jodd.datetime.formatter; 4 5 import jodd.datetime.DateTimeStamp; 6 import jodd.datetime.JDateTime; 7 8 /** 9 * Date time formatter performs conversion both from and to string representation of time. 10 * 11 * @see AbstractFormatter 12 */ 13 public interface JdtFormatter { 14 15 /** 16 * Converts date time to a string using specified format. 17 * 18 * @param jdt JDateTime to read from 19 * @param format format 20 * 21 * @return formatted string with date time information 22 */ 23 public String convert(JDateTime jdt, String format); 24 25 /** 26 * Parses string given in specified format and extracts time information. 27 * It returns a new instance of <code>DateTimeStamp</code> or <code>null</code> if error occurs. 28 * 29 * @param value string containing date time values 30 * @param format format 31 * 32 * @return DateTimeStamp instance with populated data 33 */ 34 public DateTimeStamp parse(String value, String format); 35 } 36