Java XML Date toDate(String date)

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

Description

to Date

License

Open Source License

Declaration

public static Date toDate(String date) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
import javax.xml.bind.DatatypeConverter;

public class Main {
    private static final String TIMEZONE = "UTC";

    public static Date toDate(String date) {
        Calendar cal = DatatypeConverter.parseDateTime(date);
        cal.setTimeZone(TimeZone.getTimeZone(TIMEZONE));
        return cal.getTime();
    }//from   w ww.  j  av a2s .c om
}

Related

  1. printDate(final Calendar date)
  2. printDate(java.util.Date dt)
  3. printDateTime(final Date date)
  4. printDateUpdatedType(Calendar value)
  5. string2millis(String lexicalXSDDateTime)
  6. toJavaDate(String dateStr)
  7. toTimeZone(String date, String toTimeZone)