congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
Year.format
Code IndexAdd Tabnine to your IDE (free)

How to use
format
method
in
java.time.Year

Best Java code snippets using java.time.Year.format (Showing top 8 results out of 315)

origin: com.fasterxml.jackson.datatype/jackson-datatype-jsr310

@Override
public void serialize(Year year, JsonGenerator generator, SerializerProvider provider) throws IOException
{
  if (useTimestamp(provider)) {
    generator.writeNumber(year.getValue());
  } else {
    String str = (_formatter == null) ? year.toString() : year.format(_formatter);
    generator.writeString(str);
  }
}
origin: prestodb/presto

@Override
public void serialize(Year year, JsonGenerator generator, SerializerProvider provider) throws IOException
{
  if (useTimestamp(provider)) {
    generator.writeNumber(year.getValue());
  } else {
    String str = (_formatter == null) ? year.toString() : year.format(_formatter);
    generator.writeString(str);
  }
}
origin: FasterXML/jackson-datatype-jsr310

@Override
public void serialize(Year year, JsonGenerator generator, SerializerProvider provider) throws IOException
{
  if (useTimestamp(provider)) {
    generator.writeNumber(year.getValue());
  } else {
    String str = (_formatter == null) ? year.toString() : year.format(_formatter);
    generator.writeString(str);
  }
}
origin: amedia/freemarker-java-8

  @Override
  public Object exec(List list) throws TemplateModelException {
    return getObject().format(createDateTimeFormatter(list, 0, "yyyy"));
  }
}
origin: org.mycore.mir/mir-module

  private static String getFormatedDateString(String date, DateTimeFormatter formatter) {
    TemporalAccessor ta = formatter.parseBest(date,
      LocalDateTime::from, LocalDate::from, YearMonth::from, Year::from);
    if (ta instanceof LocalDateTime) {
      LocalDateTime ld = LocalDateTime.from(ta);
      return ld.format(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss"));
    }
    if (ta instanceof LocalDate) {
      LocalDate ld = LocalDate.from(ta);
      return ld.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
    }
    if (ta instanceof YearMonth) {
      YearMonth ld = YearMonth.from(ta);
      return ld.format(DateTimeFormatter.ofPattern("yyyy-MM"));
    }
    if (ta instanceof Year) {
      Year ld = Year.from(ta);
      return ld.format(DateTimeFormatter.ofPattern("yyyy"));
    }
    return date;
  }
}
origin: com.facebook.presto/presto-jdbc

@Override
public void serialize(Year year, JsonGenerator generator, SerializerProvider provider) throws IOException
{
  if (useTimestamp(provider)) {
    generator.writeNumber(year.getValue());
  } else {
    String str = (_formatter == null) ? year.toString() : year.format(_formatter);
    generator.writeString(str);
  }
}
origin: io.prestosql/presto-jdbc

@Override
public void serialize(Year year, JsonGenerator generator, SerializerProvider provider) throws IOException
{
  if (useTimestamp(provider)) {
    generator.writeNumber(year.getValue());
  } else {
    String str = (_formatter == null) ? year.toString() : year.format(_formatter);
    generator.writeString(str);
  }
}
origin: prestosql/presto

@Override
public void serialize(Year year, JsonGenerator generator, SerializerProvider provider) throws IOException
{
  if (useTimestamp(provider)) {
    generator.writeNumber(year.getValue());
  } else {
    String str = (_formatter == null) ? year.toString() : year.format(_formatter);
    generator.writeString(str);
  }
}
java.timeYearformat

Javadoc

Outputs this year as a String using the formatter.

This year will be passed to the formatter DateTimeFormatter#format(TemporalAccessor).

Popular methods of Year

  • of
    Obtains an instance of Year. This method accepts a year value from the proleptic ISO calendar system
  • getValue
    Gets the year value. The year returned by this method is proleptic as per get(YEAR).
  • parse
    Obtains an instance of Year from a text string using a specific formatter. The text is parsed using
  • now
    Obtains the current year from the system clock in the specified time-zone. This will query the Clock
  • toString
    Outputs this year as a String.
  • atDay
    Combines this year with a day-of-year to create a LocalDate. This returns a LocalDate formed from th
  • from
    Obtains an instance of Year from a temporal object. A TemporalAccessor represents some form of date
  • isLeap
    Checks if the year is a leap year, according to the ISO proleptic calendar system rules. This method
  • atMonthDay
    Combines this year with a month-day to create a LocalDate. This returns a LocalDate formed from this
  • atMonth
    Combines this year with a month to create a YearMonth. This returns a YearMonth formed from this yea
  • compareTo
    Compares this year to another year. The comparison is based on the value of the year. It is "consist
  • plusYears
    Returns a copy of this year with the specified number of years added. This instance is immutable and
  • compareTo,
  • plusYears,
  • getLong,
  • minusYears,
  • plus,
  • <init>,
  • get,
  • length,
  • range

Popular in Java

  • Creating JSON documents from java classes using gson
  • setScale (BigDecimal)
  • getSystemService (Context)
  • findViewById (Activity)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Top 12 Jupyter Notebook Extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now