Java yyyy formatSimpleDate(Date date)

Here you can find the source of formatSimpleDate(Date date)

Description

format Simple Date

License

Apache License

Declaration

public static String formatSimpleDate(Date date) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;

public class Main {
    public static final SimpleDateFormat SIMPLE_DAY_FORMAT = new SimpleDateFormat("yyyy-MM-dd");

    public static String formatSimpleDate(Date date) {
        if (date == null) {
            return "";
        }//from  w w  w  .  java 2  s.c  o  m
        return SIMPLE_DAY_FORMAT.format(date);
    }

    /**
     * Format date with UTC time zone.
     * 
     * @param date
     * @param pattern
     * @return
     */
    public static String format(Date date, String pattern) {
        SimpleDateFormat sdf = new SimpleDateFormat(pattern);
        sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
        return sdf.format(date);
    }
}

Related

  1. formatHL7TSFormat4Date(Date time)
  2. formatJJJJMMTT(long time)
  3. formatPGNDate(final Date pDate)
  4. formatRTGSDate(java.util.Date date)
  5. formatShortDate(Date date)
  6. formatSimpleGermanDateString(Date date)
  7. formatSpaydDate(Date date, TimeZone tz)
  8. formatStr(Date date)
  9. formatString(Date date)