Java Minute Get getMin()

Here you can find the source of getMin()

Description

get Min

License

Open Source License

Declaration

public static Date getMin() 

Method Source Code

//package com.java2s;

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

import java.util.Date;

import java.util.TimeZone;

public class Main {
    public static final String _DATE_MIN = "1000-01-02 00:00:00";

    public static Date getMin() {
        return toDate(_DATE_MIN);
    }//from w w  w . ja v  a2s .  c  o  m

    /**
     * This function is use to convert string date format to data format
     * @param dateStr
     * @return 
     */
    public static Date toDate(String dateStr) {
        return toDate(dateStr, null);
    }

    /**
     * Convert string date format with time zone
     * @param dateStr
     * @param tz
     * @return 
     */
    public static Date toDate(String dateStr, TimeZone tz) {
        if (tz == null)
            tz = TimeZone.getDefault();
        if (dateStr == null)
            return null;

        SimpleDateFormat fmt = null;
        if (dateStr.length() == 19) {
            fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            fmt.setTimeZone(tz);
        } else {
            fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z");
        }
        try {
            return fmt.parse(dateStr);
        } catch (ParseException e) {

            return null;
        }
    }
}

Related

  1. getHMTimeInMinutes(final String timeStr)
  2. getHourMinuteSecond(long misSecond)
  3. getHoursMinutesSeconds(float timeInSeconds)
  4. getLessThanOneMinuteAgoRendering()
  5. getMilliSecondFromMinute(int minute)
  6. getMin(String dateTime)
  7. getMinDateString(Date date)
  8. getMineType(String urlFile)
  9. getMininte(Date time)