public static int strToDate ( String dateStr , String fromFormat ) { // It is OK to use UTC, we just want get the epoch days // TODO use offset, better performance long ts = parseToTimeMillis ( dateStr , fromFormat , TimeZone . getTimeZone ( "UTC" ) ) ; ZoneId zoneId = ZoneId . of ( "UTC" ) ; Instant instant = Instant . ofEpochMilli ( ts ) ; ZonedDateTime zdt = ZonedDateTime . ofInstant ( instant , zoneId ) ; return DateTimeUtils . ymdToUnixDate ( zdt . getYear ( ) , zdt . getMonthValue ( ) , zdt . getDayOfMonth ( ) ) ; }
Returns the epoch days since 1970 - 01 - 01 .