Java examples for java.util:Date Parse
parse Feed Date in format of d. MMMM yyyy
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static void main(String[] argv) throws Exception { String date = "java2s.com"; System.out.println(parseFeedDate(date)); }// w w w .j a va 2 s. c o m public static long parseFeedDate(String date) { SimpleDateFormat formatter; if (date.contains(" - ")) { date = date.split(" - ")[0].trim(); } formatter = new SimpleDateFormat("d. MMMM yyyy"); Date d = null; try { d = formatter.parse(date); } catch (ParseException e) { e.printStackTrace(); } return d.getTime(); } }