Class SimpleDate
java.lang.Object
com.microblink.blinkid.results.date.SimpleDate
Simple class which represents immutable dates that are consisted of day, month and year.
-
Constructor Summary
ConstructorDescriptionSimpleDate
(int day, int month, int year) Initializes the object with the given day, month and year. -
Method Summary
Modifier and TypeMethodDescriptionint
getDay()
Returns day of the month, or0
if date is partial and day is not known.int
getMonth()
Returns month of the year, or0
if date is partial and month is not known.int
getYear()
Returns full year.static SimpleDate
parseFromString
(String dateString, String pattern) CreatesSimpleDate
instance by parsing the givendateString
, by using the givenpattern
which describes the date format.toString()
-
Constructor Details
-
SimpleDate
public SimpleDate(int day, int month, int year) Initializes the object with the given day, month and year.- Parameters:
day
- Day of the month. The first day of the month has value 1.month
- Month of the year. The first month of the year has value 1.year
- Full year.
-
-
Method Details
-
getDay
public int getDay()Returns day of the month, or0
if date is partial and day is not known.- Returns:
- day of the month, or
0
if date is partial and day is not known. The first day of the month has value 1.
-
getMonth
public int getMonth()Returns month of the year, or0
if date is partial and month is not known.- Returns:
- month of the year, or
0
if date is partial and month is not known. The first month of the year has value 1.
-
getYear
public int getYear()Returns full year.- Returns:
- full year.
-
parseFromString
@Nullable public static SimpleDate parseFromString(@NonNull String dateString, @NonNull String pattern) CreatesSimpleDate
instance by parsing the givendateString
, by using the givenpattern
which describes the date format.- Parameters:
dateString
- AString
whose beginning should be parsed.pattern
- the pattern describing the date format, formatting is the same as inSimpleDateFormat
.- Returns:
- parsed date as
SimpleDate
instance, ornull
if thedateString
cannot be parsed. - Throws:
IllegalArgumentException
- if the given pattern is invalid
-
toString
-