Java Parse Date parseDate(String dateStr)

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

Description

parse Date

License

Apache License

Declaration

private static Date parseDate(String dateStr) 

Method Source Code


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

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

import java.util.Date;

public class Main {
    private static Date parseDate(String dateStr) {
        if (dateStr == null || dateStr.length() < 14)
            return null;

        int hour = Integer.parseInt(dateStr.substring(0, 2));
        int mins = Integer.parseInt(dateStr.substring(3, 5));
        String date = dateStr.substring(6);
        SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy");
        try {/* w  ww . j  ava  2 s . c  om*/
            Date tmp = format.parse(date);
            return new Date(tmp.getTime() + 60 * 60 * 1000 * hour + 60 * 1000 * mins);
        } catch (ParseException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return null;
    }
}

Related

  1. parseDate(String dateStr)
  2. parseDate(String dateStr)
  3. parseDate(String dateStr)
  4. parseDate(String dateStr)
  5. parseDate(String dateStr)
  6. parseDate(String dateStr)
  7. parseDate(String dateStr)
  8. parseDate(String dateStr)
  9. parseDate(String datestr)