Package com.backblaze.b2.util
Class B2DateTimeUtil
- java.lang.Object
-
- com.backblaze.b2.util.B2DateTimeUtil
-
public class B2DateTimeUtil extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
durationString(long deltaSecs)
static java.lang.String
formatFguidDateTime(java.time.LocalDateTime dateTime)
Returns a date-time in FGUID form: "d20150315_m092654"static java.lang.String
formatSolidDate(java.time.LocalDate date)
Formats a date in "solid" format, like "20150314"static java.time.LocalDateTime
parseDateTime(java.lang.String str)
Parses a date-time string in any one of these formats: "20150314092654" - "solid" Backblaze dates "d20150314_m092654" - FGUID-style Backblaze dates "2015-03-14 09:26:54" - ISO-8601 with space "2015-03-14T09:26" - ISO-8601 but no seconds "2015-03-14T09:26:54" - ISO-8601 "2015-03-14T09:26:54.547" - ISO-8601static java.time.Duration
parseDuration(java.lang.String str)
-
-
-
Field Detail
-
ONE_SECOND_IN_MILLIS
public static final long ONE_SECOND_IN_MILLIS
- See Also:
- Constant Field Values
-
MIN_YEAR
public static final int MIN_YEAR
- See Also:
- Constant Field Values
-
MAX_YEAR
public static final int MAX_YEAR
- See Also:
- Constant Field Values
-
MIN_MONTH
public static final int MIN_MONTH
- See Also:
- Constant Field Values
-
MAX_MONTH
public static final int MAX_MONTH
- See Also:
- Constant Field Values
-
MIN_DAY
public static final int MIN_DAY
- See Also:
- Constant Field Values
-
MAX_DAY
public static final int MAX_DAY
- See Also:
- Constant Field Values
-
-
Method Detail
-
formatSolidDate
public static java.lang.String formatSolidDate(java.time.LocalDate date)
Formats a date in "solid" format, like "20150314"
-
parseDateTime
public static java.time.LocalDateTime parseDateTime(java.lang.String str)
Parses a date-time string in any one of these formats: "20150314092654" - "solid" Backblaze dates "d20150314_m092654" - FGUID-style Backblaze dates "2015-03-14 09:26:54" - ISO-8601 with space "2015-03-14T09:26" - ISO-8601 but no seconds "2015-03-14T09:26:54" - ISO-8601 "2015-03-14T09:26:54.547" - ISO-8601
-
formatFguidDateTime
public static java.lang.String formatFguidDateTime(java.time.LocalDateTime dateTime)
Returns a date-time in FGUID form: "d20150315_m092654"
-
parseDuration
public static java.time.Duration parseDuration(java.lang.String str)
- Parameters:
str
- string to parse. it must match: [-][Dd][Dh][Dm][Ds] where D is [0-9]+ and at least one of the numeric parts must be specified.- Returns:
- the duration described by the given string or null if it doesn't match the pattern.
-
durationString
public static java.lang.String durationString(long deltaSecs)
- Returns:
- a succinct string describing the given number of seconds.
-
-