|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jgit.util.GitDateParser
public class GitDateParser
Parses strings with time and date specifications into Date
.
When git needs to parse strings specified by the user this parser can be
used. One example is the parsing of the config parameter gc.pruneexpire. The
parser can handle only subset of what native gits approxidate parser
understands.
Field Summary | |
---|---|
static java.util.Date |
NEVER
The Date representing never. |
Constructor Summary | |
---|---|
GitDateParser()
|
Method Summary | |
---|---|
static java.util.Date |
parse(java.lang.String dateStr,
java.util.Calendar now)
Parses a string into a Date . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.util.Date NEVER
Constructor Detail |
---|
public GitDateParser()
Method Detail |
---|
public static java.util.Date parse(java.lang.String dateStr, java.util.Calendar now) throws java.text.ParseException
Date
. Since this parser also supports
relative formats (e.g. "yesterday") the caller can specify the reference
date. These types of strings can be parsed:
dateStr
- the string to be parsednow
- the base date which is used for the calculation of relative
formats. E.g. if baseDate is "25.8.2012" then parsing of the
string "1 week ago" would result in a date corresponding to
"18.8.2012". This is used when a JGit command calls this
parser often but wants a consistent starting point for calls.null
then the current time will be used
instead.
Date
java.text.ParseException
- if the given dateStr was not recognized
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |