Java Minute Get getMiniTime()

Here you can find the source of getMiniTime()

Description

get Mini Time

License

Open Source License

Declaration

public static Date getMiniTime() 

Method Source Code


//package com.java2s;
import java.text.DateFormat;

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {

    public static Date getMiniTime() {
        try {//from w  w  w. ja va  2 s.c  o m
            return stringToTime("yyyy-MM-dd HH:mm:ss", "1900-01-01 00:00:00");
        } catch (Exception ex) {
            return new Date(0);
        }
    }

    public static Date stringToTime(String format, String sDate) throws Exception {
        DateFormat df = new SimpleDateFormat(format);
        Date _date = df.parse(sDate);
        if (timeToString(format, _date).equals(sDate)) {
            return _date;
        } else {
            throw new Exception(sDate + " is error");
        }
    }

    public static String timeToString(String format, Date date) {
        DateFormat df = new SimpleDateFormat(format);
        return df.format(date);
    }
}

Related

  1. getMin()
  2. getMin(String dateTime)
  3. getMinDateString(Date date)
  4. getMineType(String urlFile)
  5. getMininte(Date time)
  6. getMinute()
  7. getMinute()
  8. getMinute()
  9. getMinute(Date date)