Java Year From toShortW3CDTF(Date d, boolean yearOnly)

Here you can find the source of toShortW3CDTF(Date d, boolean yearOnly)

Description

to Short WCDTF

License

Open Source License

Declaration

public static String toShortW3CDTF(Date d, boolean yearOnly) 

Method Source Code

//package com.java2s;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    public static String toShortW3CDTF(Date d, boolean yearOnly) {
        SimpleDateFormat format = new SimpleDateFormat(yearOnly ? "yyyy"
                : "yyyy-MM-dd");
        return format.format(d);
    }/*from  ww w .  jav  a  2  s .  c  o m*/
}

Related

  1. getYearStart(long ts)
  2. getYearStartTime()
  3. isInYear(String dateStr, int year)
  4. setYears(Date date, int amount)
  5. toNowYear(Date date)
  6. year()
  7. year(Date date)
  8. year(long time)
  9. yearformMatDate(Date date)