public static int toUnix(String time, String pattern) {
        LocalDateTime formatted = LocalDateTime.parse(time, DateTimeFormatter.ofPattern(pattern));
        return (int) formatted.atZone(ZoneId.systemDefault()).toInstant().getEpochSecond();
    }
@Test
    public void testToUnix() {
        int unixTime = DateKit.toUnix(date);
        Assert.assertEquals(1505892470, unixTime);

        unixTime = DateKit.toUnix("2017-09-09 11:22:33");
        Assert.assertEquals(1504927353, unixTime);

        unixTime = DateKit.toUnix("2017-09-09 11:22", "yyyy-MM-dd HH:mm");
        Assert.assertEquals(1504927320, unixTime);

        unixTime = DateKit.nowUnix();
        Assert.assertNotNull(unixTime);
    }