public class GitDateParser
extends java.lang.Object
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.Modifier and Type | Field and Description |
---|---|
static java.util.Date |
NEVER
The Date representing never.
|
Constructor and Description |
---|
GitDateParser() |
Modifier and Type | Method and Description |
---|---|
static java.util.Date |
parse(java.lang.String dateStr,
java.util.Calendar now)
Parses a string into a
Date . |
public static final java.util.Date NEVER
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 recognizedCopyright © 2013. All Rights Reserved.