Java LocalDateTime Format formattedWeek(LocalDateTime localDateTime)

Here you can find the source of formattedWeek(LocalDateTime localDateTime)

Description

formatted Week

License

Open Source License

Declaration

static public String formattedWeek(LocalDateTime localDateTime) 

Method Source Code

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

import java.time.LocalDateTime;

import java.time.temporal.WeekFields;

import java.util.Locale;

public class Main {
    static public String formattedWeek(LocalDateTime localDateTime) {
        return String.format("%04d-%02d", localDateTime.getYear(),
                localDateTime.get(WeekFields.of(Locale.getDefault())
                        .weekOfWeekBasedYear()));
    }//from  w w w.j av  a2  s  .  co  m
}

Related

  1. formatDateGeneric(DateTimeFormatter dateTimeFormatter, LocalDateTime localDateTime)
  2. formatDateTime(LocalDateTime dateTime)
  3. formatDayOfMonth(LocalDateTime dateTime)
  4. formatLocalDateTimeToString(LocalDateTime date)
  5. formatShortDate(LocalDateTime dateTime)
  6. formatTime(LocalDateTime dateTime)
  7. formatTime(LocalDateTime time)
  8. localDateTime2Str(LocalDateTime localDateTime, String dateTimeFormatter)
  9. toDoubleExcelFormat(LocalDateTime date, boolean date1904)