Here you can find the source of convertStringToDate(String arg)
Parameter | Description |
---|---|
arg | string to convert |
private static Date convertStringToDate(String arg)
//package com.java2s; //License from project: Open Source License import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; public class Main { /**/*from ww w. ja va 2 s . co m*/ * Converts string to Date using Default date format * * @param arg * string to convert * @return Date */ private static Date convertStringToDate(String arg) { DateFormat df = getIsoFormat(); Date d = null; try { d = df.parse(arg); } catch (ParseException e) { // } return d; } /** * Returns ISO DataFormat 'yyyy-MM-dd'T'HH:mm:ss.SSS' * * @return ISO DateFormat */ public static DateFormat getIsoFormat() { SimpleDateFormat isoFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS"); //$NON-NLS-1$ isoFormat.setTimeZone(TimeZone.getTimeZone("GMT")); //$NON-NLS-1$ return isoFormat; } }