Java Day dayFilter(Date date)

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

Description

day Filter

License

Open Source License

Declaration

public static Date dayFilter(Date date) 

Method Source Code

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

import java.text.ParseException;
import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static final String _8DIGIT_DATE_1 = "yyyy/MM/dd";

    public static Date dayFilter(String text) {
        SimpleDateFormat format = new SimpleDateFormat(_8DIGIT_DATE_1);
        try {/*from   w ww  .  j a va  2  s  .co m*/
            return format.parse(text);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return new Date();
    }

    public static Date dayFilter(Date date) {
        SimpleDateFormat format = new SimpleDateFormat(_8DIGIT_DATE_1);
        return dayFilter(format.format(date));
    }

    public static Date parse(String text, String type) throws ParseException {
        SimpleDateFormat format = new SimpleDateFormat(type);
        return format.parse(text);
    }

    public static String format(Date aDate, String type) {
        SimpleDateFormat sdf = new SimpleDateFormat(type);

        return sdf.format(aDate);
    }

    public static String format(Long dateMs, String type) {
        Date date = new Date(dateMs);
        SimpleDateFormat sdf = new SimpleDateFormat(type);
        return sdf.format(date);
    }
}

Related

  1. day2ThuesDay(Date date)
  2. dayDiff(Date date1, String date2)
  3. dayEnd(Date date)
  4. dayFillter(String text, String type)
  5. dayFillter(String text, String type)
  6. dayForAMorPM(String date)
  7. dayFormat(Date date)
  8. dayOfDate(Date s)
  9. dayOfWeekAbr(Date date)