Java Calendar Format formatDay(java.util.Calendar d)

Here you can find the source of formatDay(java.util.Calendar d)

Description

format Day

License

Open Source License

Declaration

public static String formatDay(java.util.Calendar d) 

Method Source Code

//package com.java2s;
/*//from  w ww . j  av  a  2 s.co m
 * Copyright 2010 Mttang.com All right reserved. This software is the
 * confidential and proprietary information of Mttang.com ("Confidential
 * Information"). You shall not disclose such Confidential Information and shall
 * use it only in accordance with the terms of the license agreement you entered
 * into with Mttang.com.
 */

import java.text.SimpleDateFormat;

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

    public static String formatDay(java.util.Date d) {
        return yyyyMMdd.format(d);
    }

    public static String formatDay(java.util.Calendar d) {
        return yyyyMMdd.format(d.getTime());
    }
}

Related

  1. formatDate(Calendar date, int precision)
  2. FormatDate(Calendar p_date, String p_separator)
  3. formatDate(String formats, Calendar date)
  4. formatDateTime(Calendar cal)
  5. formatDateTimeUTC(Calendar datetime)
  6. formatDuration(Calendar t1, Calendar t2, boolean precise)
  7. formatRfc3339Calendar(Calendar cal)
  8. formatTime(Calendar cal, StringBuffer sb)
  9. formatToHTTPDate(Calendar calendar)