28 lines
818 B
Java
28 lines
818 B
Java
package org.schabi.newpipe.extractor.services.media_ccc.extractors;
|
|
|
|
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
|
|
|
import java.text.ParseException;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.Calendar;
|
|
import java.util.Date;
|
|
|
|
public class MediaCCCParsingHelper {
|
|
private MediaCCCParsingHelper() {
|
|
}
|
|
|
|
public static Calendar parseDateFrom(String textualUploadDate) throws ParsingException {
|
|
Date date;
|
|
try {
|
|
date = new SimpleDateFormat("yyyy-MM-dd").parse(textualUploadDate);
|
|
} catch (ParseException e) {
|
|
throw new ParsingException("Could not parse date: \"" + textualUploadDate + "\"", e);
|
|
}
|
|
|
|
final Calendar uploadDate = Calendar.getInstance();
|
|
uploadDate.setTime(date);
|
|
return uploadDate;
|
|
}
|
|
|
|
}
|