Question: I receive date as string from web service in following format `2014-02-27T11:17:00.000Z` Could someone tell me how to parse it as Date time object in Java.

I tried parsing it `Date.parse()` but it didn't work properly.

Then I tried date formatter but it crashes the app. Could someone enlighten me please.

Answer: 
```
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
    Date d = sdf.parse("2014-02-27T11:17:00.000Z");

```
Declare a SimpleDateTimeFormat to match your datetime from C# and then use .parse() method on it to get the (Java) Date.

Example:

```
private static final SimpleDateFormat FORMAT_FULL_DATE = new SimpleDateFormat("yyyy-MM-dd'T'kk:mm:ss'.000Z'");  // replace kk with hh for am/pm format

public static Date getDateTimeFromString(final String string) {
    try {
        return FORMAT_FULL_DATE.parse(string);
    } catch (ParseException e) {
        e.printStackTrace();
        return null;
    }
}

```