Here you can find the source of stringToDate(String date)
Parameter | Description |
---|---|
date | De datum zoals hij in de magister response staat |
Parameter | Description |
---|---|
ParseException | an exception |
public static DateTime stringToDate(String date) throws ParseException
//package com.java2s; //License from project: Open Source License import org.joda.time.DateTime; import org.joda.time.DateTimeZone; import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormatter; import java.text.ParseException; public class Main { public static final DateTimeFormatter magisterToDateFormatter = DateTimeFormat .forPattern("yyyy-MM-dd'T'HH:mm:ss.SSSSSSS'Z'").withZoneUTC(); /**//from w w w.j a va 2 s.co m * * @param date De datum zoals hij in de magister response staat * @return De date in een Date object * @throws ParseException */ public static DateTime stringToDate(String date) throws ParseException { return DateTime.parse(date, magisterToDateFormatter).withZone(DateTimeZone.getDefault()); } }