Skip to content

Instantly share code, notes, and snippets.

@K0NRAD
Created February 10, 2014 07:02
Show Gist options
  • Save K0NRAD/8911553 to your computer and use it in GitHub Desktop.
Save K0NRAD/8911553 to your computer and use it in GitHub Desktop.
guava DateFormatFunction
public class DateFormatFunction implements Function<Date,String> {
private String format;
public formatFunction(String format) {
this.format = format;
}
@Override
public String apply(Date date) {
return new Simpleformat(format).format(date);
}
}
public class StringToDateFunction implements Function<String,Function<Date,String>> {
@Override
public Function<Date, String> apply(String string) {
return new DateFormatFunction(string);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment