Java Date Start getStrDateToDate(String dateStr)

Here you can find the source of getStrDateToDate(String dateStr)

Description

get Str Date To Date

License

Apache License

Declaration

public static Date getStrDateToDate(String dateStr) 

Method Source Code

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

import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

import java.util.StringTokenizer;

public class Main {

    public static Date getStrDateToDate(String dateStr) {
        String dateSplit = getDateSplit();
        if (dateSplit.equals("."))
            dateSplit = "\\.";
        StringTokenizer filter = new StringTokenizer(dateStr, dateSplit);
        int year = Integer.parseInt(filter.nextToken());
        int mon = Integer.parseInt(filter.nextToken()) - 1;
        int day = Integer.parseInt(filter.nextToken());

        Calendar cal = new GregorianCalendar(year, mon, day);
        return cal.getTime();
    }//from  w ww. jav  a2s  .  c  om

    public static String getDateSplit() {
        return ".";
    }
}

Related

  1. getStartOfQuarter(Date dt)
  2. getStartTimeByManDay(Date serviceStartTime)
  3. getStartTimeOfDate(Date date)
  4. getStartTimeOfDay(Date date)
  5. getStartTimeOfDay(Date date)
  6. getStringDate()
  7. getStringDate(byte[] block, int pos)
  8. getStringInDate(String dateString)