Java Instant Create getThisMonthBeginInstant()

Here you can find the source of getThisMonthBeginInstant()

Description

get This Month Begin Instant

License

Open Source License

Declaration

public static Instant getThisMonthBeginInstant() 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.time.*;

import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalAdjusters;

public class Main {
    public static Instant getThisMonthBeginInstant() {
        LocalDateTime localDate = LocalDateTime.now().withSecond(0)
                .withHour(0).withMinute(0)
                .with(TemporalAdjusters.firstDayOfMonth())
                .truncatedTo(ChronoUnit.SECONDS);
        return localDate.toInstant(ZoneOffset.UTC);
    }//from w  w  w.  j a  v  a2 s.  c o  m
}

Related

  1. end(String msg, long amount, Instant start)
  2. getEarliestInstant()
  3. getInstant(final Calendar calendar)
  4. getInstant(LocalDate localDate)
  5. getInstantOfEpoch(long seconds)
  6. instant(int _y, int _m, int _d, int _H, int _M, int _S)
  7. toInstant(BigDecimal value)