Java Date Value Check isData(long date)

Here you can find the source of isData(long date)

Description

is Data

License

Apache License

Declaration

public static boolean isData(long date) 

Method Source Code


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

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

public class Main {
    private final static SimpleDateFormat _data = new SimpleDateFormat("dd/MM/yyyy");

    public static boolean isData(long date) {
        return !"".equals(formattaData(date));
    }/*w  ww  . j  av a 2s .c o m*/

    public static boolean isData(String date) {
        Date d = toDate(date);
        return d != null && _data.format(d).equals(date);
    }

    public static String formattaData(long date) {
        try {
            return _data.format(new Date(date));
        } catch (Exception e) {

        }
        return "";
    }

    public static Date toDate(String date) {
        Date d = null;
        try {
            d = _data.parse(date);
        } catch (Exception e) {

        }
        return d;
    }
}

Related

  1. isDataOra(String date)
  2. isDate(final String date)
  3. isDate(final String date)
  4. isDate(final String dateString)