Java String to Date stringToDate(String date)

Here you can find the source of stringToDate(String date)

Description

string To Date

License

Open Source License

Parameter

Parameter Description
date De datum zoals hij in de magister response staat

Exception

Parameter Description
ParseException an exception

Return

De date in een Date object

Declaration

public static DateTime stringToDate(String date) throws ParseException 

Method Source Code

//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());
    }
}

Related

  1. stringToDate(String date)
  2. stringToDate(String date)
  3. stringToDate(String date)
  4. stringToDate(String date)
  5. stringToDate(String date)
  6. StringToDate(String date)
  7. stringToDate(String date)
  8. stringToDate(String date)
  9. stringToDate(String date, String format)