Here you can find the source of rfc3339ToDate(String s)
Parameter | Description |
---|---|
s | the String |
Parameter | Description |
---|---|
ParseException | thrown if a syntax error occurred |
public static Date rfc3339ToDate(String s) throws ParseException
//package com.java2s; // compliance with the InfoGrid license. The InfoGrid license and important import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { /**//from www . j a v a2s.com * Date format to use for RFC 3339. */ public static final SimpleDateFormat theRfc3339Format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); /** * Convert an RFC 3309 String to a Date. * * @param s the String * @return the Date * @throws ParseException thrown if a syntax error occurred */ public static Date rfc3339ToDate(String s) throws ParseException { s = s.toUpperCase(); Date ret = theRfc3339Format.parse(s); return ret; } }