public static int toUnix ( String time , String pattern ) { LocalDateTime formatted = LocalDateTime . parse ( time , DateTimeFormatter . ofPattern ( pattern ) ) ; return ( int ) formatted . atZone ( ZoneId . systemDefault ( ) ) . toInstant ( ) . getEpochSecond ( ) ; }
format string time to unix time