| | 227 | /** |
| | 228 | * Parses the given String as schema date time representation and returns |
| | 229 | * a Date object holding the given time. |
| | 230 | * This method must only be used after a JAXBContext has been initialized, |
| | 231 | * otherwise it is likely that a NullpointerException is thrown. |
| | 232 | * @param date the date time in schema dateTime |
| | 233 | * @return a newly generated Date object representing the time given in the |
| | 234 | * date. |
| | 235 | */ |
| | 236 | public static Date fromDateTimeString (String date) |
| | 237 | { |
| | 238 | final Calendar cal = DatatypeConverter.parseDateTime(date); |
| | 239 | cal.setLenient(false); |
| | 240 | return new Date(cal.getTimeInMillis()); |
| | 241 | } |
| | 242 | |
| | 243 | /** |
| | 244 | * Parses the given String as schema date representation and returns |
| | 245 | * a Date object holding the given time. |
| | 246 | * This method must only be used after a JAXBContext has been initialized, |
| | 247 | * otherwise it is likely that a NullpointerException is thrown. |
| | 248 | * @param date the date in schema date representation |
| | 249 | * @return a newly generated Date object representing the time given in the |
| | 250 | * date. |
| | 251 | */ |
| | 252 | public static Date fromDateString (String date) |
| | 253 | { |
| | 254 | final Calendar cal = DatatypeConverter.parseDate(date); |
| | 255 | cal.setLenient(false); |
| | 256 | return new Date(cal.getTimeInMillis()); |
| | 257 | } |
| | 258 | |