parseDate

fun parseDate(dateString: String?, format: String, shouldReturnCurrentDateIfNull: Boolean = true, shouldParseAsPastDate: Boolean = false): Long

Parses a string formatted date into a UTC timestamp.

Parameters

dateString

The date to be parsed. If null and shouldReturnCurrentDateIfNull, the current time will be used instead.

format

The format of the dateString. See DISPLAY_DATE_FORMAT or RETURN_DATE_FORMAT for examples.

shouldReturnCurrentDateIfNull

If the dateString is null, use the current time instead.

shouldParseAsPastDate

If the dateString is in the future, change it to be the previous century. Ex. 1/1/77 is treated as 1/1/1977 instead of 1/1/2077.