Example usage for org.eclipse.jgit.util GitDateParser parse

List of usage examples for org.eclipse.jgit.util GitDateParser parse

Introduction

In this page you can find the example usage for org.eclipse.jgit.util GitDateParser parse.

Prototype

public static Date parse(String dateStr, Calendar now) throws ParseException 

Source Link

Document

Parses a string into a java.util.Date using the default locale.

Usage

From source file:com.google.gitiles.DateFormatterTest.java

License:Open Source License

private PersonIdent newIdent(String whenStr, String tzStr) throws ParseException {
    whenStr += " " + tzStr;
    Date when = GitDateParser.parse(whenStr, null);
    TimeZone tz = getTimeZone("GMT" + tzStr);
    PersonIdent ident = new PersonIdent("A User", "user@example.com", when, tz);
    // PersonIdent.toString() uses its own format with "d" instead of "dd",
    // hence the mismatches in 2 vs. 02 above. Nonetheless I think this sanity
    // check is useful enough to keep around.
    assertEquals("PersonIdent[A User, user@example.com, " + whenStr + "]", ident.toString());
    return ident;
}