Example usage for java.time Month JANUARY

List of usage examples for java.time Month JANUARY

Introduction

In this page you can find the example usage for java.time Month JANUARY.

Prototype

Month JANUARY

To view the source code for java.time Month JANUARY.

Click Source Link

Document

The singleton instance for the month of January with 31 days.

Usage

From source file:Main.java

public static void main(String[] args) {
    Year y = Year.of(2014);
    LocalDate l = y.atMonthDay(MonthDay.of(Month.JANUARY, 21));
    System.out.println(l);// ww  w  .  j a va 2s.co  m

}

From source file:Main.java

public static void main(String[] args) {
    Period p = Period.between(LocalDate.of(2009, Month.JANUARY, 21), LocalDate.of(2019, Month.JANUARY, 21));

    System.out.println(p.get(ChronoUnit.DAYS));

    LocalDate today = LocalDate.now();
    LocalDate birthday = LocalDate.of(1960, Month.JANUARY, 1);

    LocalDate nextBDay = birthday.withYear(today.getYear());

    nextBDay = nextBDay.plusYears(1);/*from   w  ww  . j a  v a2  s  . c om*/

    p = Period.between(today, nextBDay);
    long p2 = ChronoUnit.DAYS.between(today, nextBDay);
    System.out.println(p.getMonths() + " months");
    System.out.println(p.getDays() + " days");
}

From source file:Main.java

public static void main(String[] args) {

    LocalDate today = LocalDate.now();
    LocalDate birthday = LocalDate.of(1960, Month.JANUARY, 1);

    LocalDate nextBDay = birthday.withYear(today.getYear());

    //If your birthday has occurred this year already, add 1 to the year.
    if (nextBDay.isBefore(today) || nextBDay.isEqual(today)) {
        nextBDay = nextBDay.plusYears(1);
    }//from ww w .  j a v  a  2  s.  co  m

    Period p = Period.between(today, nextBDay);
    long p2 = ChronoUnit.DAYS.between(today, nextBDay);
    System.out.println("There are " + p.getMonths() + " months, and " + p.getDays()
            + " days until your next birthday. (" + p2 + " total)");
}

From source file:Main.java

public static void main(String[] args) {
    DateTimeFormatter formatter = new DateTimeFormatterBuilder().appendLiteral("New Year in ")
            .appendValue(ChronoField.YEAR).appendLiteral(" is  on  ")
            .appendText(ChronoField.DAY_OF_WEEK, TextStyle.FULL_STANDALONE).toFormatter();
    LocalDate ld = LocalDate.of(2014, Month.JANUARY, 1);
    String str = ld.format(formatter);
    System.out.println(str);/*from   w w  w .  ja  v  a2 s . c  o m*/

}

From source file:Main.java

public static List<Employee> persons() {
    Employee p1 = new Employee(1, "Jake", Gender.MALE, LocalDate.of(1971, Month.JANUARY, 1), 2343);
    Employee p2 = new Employee(2, "Jack", Gender.MALE, LocalDate.of(1972, Month.JULY, 21), 7100);
    Employee p3 = new Employee(3, "Jane", Gender.FEMALE, LocalDate.of(1973, Month.MAY, 29), 5455);
    Employee p4 = new Employee(4, "Jode", Gender.MALE, LocalDate.of(1974, Month.OCTOBER, 16), 1800);
    Employee p5 = new Employee(5, "Jeny", Gender.FEMALE, LocalDate.of(1975, Month.DECEMBER, 13), 1234);
    Employee p6 = new Employee(6, "Jason", Gender.MALE, LocalDate.of(1976, Month.JUNE, 9), 3211);

    List<Employee> persons = Arrays.asList(p1, p2, p3, p4, p5, p6);

    return persons;
}

From source file:Main.java

public static List<Employee> persons() {
    Employee p1 = new Employee(1, "Jake", Gender.MALE, LocalDate.of(1971, Month.JANUARY, 1), 2343.0);
    Employee p2 = new Employee(2, "Jack", Gender.MALE, LocalDate.of(1972, Month.JULY, 21), 7100.0);
    Employee p3 = new Employee(3, "Jane", Gender.FEMALE, LocalDate.of(1973, Month.MAY, 29), 5455.0);
    Employee p4 = new Employee(4, "Jode", Gender.MALE, LocalDate.of(1974, Month.OCTOBER, 16), 1800.0);
    Employee p5 = new Employee(5, "Jeny", Gender.FEMALE, LocalDate.of(1975, Month.DECEMBER, 13), 1234.0);
    Employee p6 = new Employee(6, "Jason", Gender.MALE, LocalDate.of(1976, Month.JUNE, 9), 3211.0);
    List<Employee> persons = Arrays.asList(p1, p2, p3, p4, p5, p6);
    return persons;
}

From source file:Main.java

public static List<Employee> persons() {
    Employee p1 = new Employee(1, "Jake", Gender.MALE, LocalDate.of(1971, Month.JANUARY, 1), 2343.0);
    Employee p2 = new Employee(2, "Jack", Gender.MALE, LocalDate.of(1972, Month.JULY, 21), 7100.0);
    Employee p3 = new Employee(3, "Jane", Gender.FEMALE, LocalDate.of(1973, Month.MAY, 29), 5455.0);
    Employee p4 = new Employee(4, "Jode", Gender.MALE, LocalDate.of(1974, Month.OCTOBER, 16), 1800.0);
    Employee p5 = new Employee(5, "Jeny", Gender.FEMALE, LocalDate.of(1975, Month.DECEMBER, 13), 1234.0);
    Employee p6 = new Employee(6, "Jason", Gender.MALE, LocalDate.of(1976, Month.JUNE, 9), 3211.0);

    List<Employee> persons = Arrays.asList(p1, p2, p3, p4, p5, p6);

    return persons;
}

From source file:Main.java

private LocalDate getMartinLutherKingDayForDateInYear(int year) {
    return LocalDate.of(year, Month.JANUARY, 1).with(TemporalAdjusters.dayOfWeekInMonth(3, DayOfWeek.MONDAY));
}

From source file:com.hengyi.japp.tools.DateTimeUtil.java

public static Date toDate(LocalTime localTime) {
    return localTime == null ? null : toDate(localTime.atDate(LocalDate.of(1977, Month.JANUARY, 1)));
}

From source file:cz.muni.fi.javaseminar.kafa.bookregister.AuthorManagerImplTest.java

@Before
public void setUp() throws SQLException, FileNotFoundException {
    manager = (AuthorManagerImpl) CTX.getBean("authorManager");
    dataSource = manager.getDataSource();
    DBUtils.executeSqlScript(dataSource, BookManager.class.getResource(SQL_SCRIPT_NAME));

    authorOlda = Author.builder().firstname("Oldrich").surname("Faldik").nationality("Czech")
            .description("Novodoby autor").dateOfBirth(LocalDate.of(1990, Month.JANUARY, 20));

    authorKarel = Author.builder().firstname("Karel").surname("Soukup").nationality("Czech")
            .description("Stredovek").dateOfBirth(LocalDate.of(1450, Month.AUGUST, 12));
}