I'm trying to round a unix time to the first day of the month in Java, but without success. Example:
1314057600 (Tue, 23 Aug 2011 00:00:00 GMT)
to
1312156800 (Mon, 01 Aug 2011 00:00:00 GMT)
The unix time I'm reading from a file and storing it as a Long inside a variable (variable named "valor"). So far I've been able to create a Java timestamp with it
LocalDateTime timestamp = LocalDateTime.ofInstant(Instant.ofEpochSecond(valor), ZoneId.systemDefault());
and create a new timestamp for the beggining of the month:
LocalDate key = LocalDate.of(timestamp.getYear(), timestamp.getMonthValue(), 1);
How do I get this new timestamp as a Long?