本文整理汇总了Java中org.pojava.datetime.DateTime类的典型用法代码示例。如果您正苦于以下问题:Java DateTime类的具体用法?Java DateTime怎么用?Java DateTime使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DateTime类属于org.pojava.datetime包,在下文中一共展示了DateTime类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setMjbGenerationDateString
import org.pojava.datetime.DateTime; //导入依赖的package包/类
public void setMjbGenerationDateString(String mjbGenerationDate) {
try {
this.mjbGenerationDate = DateTime.parse(mjbGenerationDate);
} catch (Exception error) {
this.mjbGenerationDate = new DateTime();
}
}
示例2: setMjbGenerationDate
import org.pojava.datetime.DateTime; //导入依赖的package包/类
public void setMjbGenerationDate(DateTime mjbGenerationDate) {
if (mjbGenerationDate == null) {
this.mjbGenerationDate = new DateTime();
} else {
this.mjbGenerationDate = mjbGenerationDate;
}
}
示例3: setTrailerLastScan
import org.pojava.datetime.DateTime; //导入依赖的package包/类
/**
* Set the date of the last trailers scan
*
* @param lastScan date of the last trailers scan
*/
public void setTrailerLastScan(String lastScan) {
try {
if (StringTools.isValidString(lastScan)) {
setTrailerLastScan(DateTime.parse(lastScan).toMillis());
} else {
setTrailerLastScan(0);
}
} catch (IllegalArgumentException ex) {
LOG.debug("Unable to parse TrailerLastScan date from '{}', Error: {}", lastScan, ex.getMessage());
setTrailerLastScan(0);
}
}
示例4: getProcessingTime
import org.pojava.datetime.DateTime; //导入依赖的package包/类
/**
* Calculate the difference between two jukebox times
*
* @param timeStart
* @param timeEnd
* @return
*/
public static String getProcessingTime(JukeboxTimes timeStart, JukeboxTimes timeEnd) {
if (TIMES.containsKey(timeStart) && TIMES.containsKey(timeEnd)) {
DateTime processTime = new DateTime(TIMES.get(JukeboxTimes.END) - TIMES.get(JukeboxTimes.START));
return processTime.toString(DEFAULT_FORMAT, TimeZone.getTimeZone(DEFAULT_TZ));
}
return StringUtils.EMPTY;
}
示例5: getTime
import org.pojava.datetime.DateTime; //导入依赖的package包/类
/**
* Get a formatted string of the time type
*
* @param timeType
* @param timeFormat
* @return
*/
public static String getTime(JukeboxTimes timeType, String timeFormat) {
String returnValue = "";
if (TIMES.containsKey(timeType)) {
if (StringTools.isValidString(timeFormat)) {
returnValue = (new DateTime(TIMES.get(timeType)).toString(timeFormat));
} else {
returnValue = (new DateTime(TIMES.get(timeType)).toString(DEFAULT_FORMAT));
}
}
return returnValue;
}
示例6: testConvertDateToString_DateTime
import org.pojava.datetime.DateTime; //导入依赖的package包/类
/**
* Test of convertDateToString method, of class DateTimeTools.
*/
@Test
public void testConvertDateToString_DateTime() {
LOG.info("convertDateToString");
DateTime convertDate = new DateTime(0);
String result = DateTimeTools.convertDateToString(convertDate);
assertEquals("1970-01-01", result);
}
示例7: testConvertDateToString_DateTime_String
import org.pojava.datetime.DateTime; //导入依赖的package包/类
/**
* Test of convertDateToString method, of class DateTimeTools.
*/
@Test
public void testConvertDateToString_DateTime_String() {
LOG.info("convertDateToString");
DateTime convertDate = new DateTime(0);
String dateFormat = "dd/MM/yyyy";
String expResult = "01/01/1970";
String result = DateTimeTools.convertDateToString(convertDate, dateFormat);
assertEquals(expResult, result);
}
示例8: findId
import org.pojava.datetime.DateTime; //导入依赖的package包/类
/**
* Use the movie information to find the series and ID
*
* @param movie
* @return
*/
public static String findId(Movie movie) {
String id = movie.getId(THETVDB_PLUGIN_ID);
if (StringTools.isNotValidString(id)) {
List<Series> seriesList = null;
try {
if (!movie.getTitle().equals(Movie.UNKNOWN)) {
seriesList = TVDB.searchSeries(movie.getTitle(), LANGUAGE_PRIMARY);
if ((seriesList == null || seriesList.isEmpty()) && !LANGUAGE_SECONDARY.isEmpty()) {
seriesList = TVDB.searchSeries(movie.getTitle(), LANGUAGE_SECONDARY);
}
}
if (seriesList == null || seriesList.isEmpty()) {
seriesList = TVDB.searchSeries(movie.getBaseName(), LANGUAGE_PRIMARY);
if ((seriesList == null || seriesList.isEmpty()) && !LANGUAGE_SECONDARY.isEmpty()) {
seriesList = TVDB.searchSeries(movie.getBaseName(), LANGUAGE_SECONDARY);
}
}
} catch (Exception error) {
LOG.warn("Error getting ID: {}", error.getMessage());
}
if (seriesList == null || seriesList.isEmpty()) {
return Movie.UNKNOWN;
}
Series series = null;
for (Series s : seriesList) {
if (StringTools.isValidString(s.getFirstAired())) {
if (StringTools.isValidString(movie.getYear())) {
DateTime firstAired = DateTime.parse(s.getFirstAired());
if (NumberUtils.toInt(firstAired.toString("yyyy")) == NumberUtils.toInt(movie.getYear())) {
series = s;
break;
}
} else {
series = s;
break;
}
}
}
// If we can't find an exact match, select the first one
if (series == null) {
series = seriesList.get(0);
LOG.debug("No exact match for {} found, using {}", movie.getTitle(), series.getSeriesName());
}
id = String.valueOf(series.getId());
series = getSeries(id);
// Add the series to the cache (no need to get it again
CacheMemory.addToCache(CacheMemory.generateCacheKey(CACHE_SERIES, id, LANGUAGE_PRIMARY), series);
movie.setId(THETVDB_PLUGIN_ID, id);
if (StringTools.isValidString(series.getImdbId())) {
movie.setId(IMDB_PLUGIN_ID, series.getImdbId());
}
}
return id;
}
示例9: getIdFromMovieInfo
import org.pojava.datetime.DateTime; //导入依赖的package包/类
@Override
public String getIdFromMovieInfo(String title, String year, int tvSeason) {
String response = Movie.UNKNOWN;
List<Series> seriesList = null;
if (StringTools.isValidString(title)) {
seriesList = getSeriesList(title, language);
// Try Alternative Language
if ((seriesList == null || seriesList.isEmpty()) && StringTools.isValidString(language2nd)) {
seriesList = getSeriesList(title, language2nd);
}
}
int iYear = NumberUtils.toInt(year, -1);
if (seriesList != null && !seriesList.isEmpty()) {
Series series = null;
for (Series s : seriesList) {
if (StringUtils.isNotBlank(s.getFirstAired())) {
if (iYear > -1) {
DateTime firstAired = DateTime.parse(s.getFirstAired());
if (NumberUtils.toInt(firstAired.toString("yyyy"), -1) == iYear) {
series = s;
break;
}
} else {
series = s;
break;
}
}
}
if (series == null) {
series = seriesList.get(0);
}
if (series != null) {
response = String.valueOf(series.getId());
}
}
return response;
}
示例10: getWatchedDateString
import org.pojava.datetime.DateTime; //导入依赖的package包/类
private static String getWatchedDateString(long watchedDate) {
if (watchedDate == 0) {
return Movie.UNKNOWN;
}
return new DateTime(watchedDate).toString(DateTimeTools.getDateFormatLongString());
}
示例11: parseSingleEpisodeDetail
import org.pojava.datetime.DateTime; //导入依赖的package包/类
/**
* Parse a single episode detail element
*
* @param movie
* @param eEpisodeDetails
* @return
*/
private static EpisodeDetail parseSingleEpisodeDetail(Element eEpisodeDetails) {
EpisodeDetail epDetail = new EpisodeDetail();
if (eEpisodeDetails == null) {
return epDetail;
}
epDetail.setTitle(DOMHelper.getValueFromElement(eEpisodeDetails, "title"));
String tempValue = DOMHelper.getValueFromElement(eEpisodeDetails, "season");
if (StringUtils.isNumeric(tempValue)) {
epDetail.setSeason(Integer.parseInt(tempValue));
}
tempValue = DOMHelper.getValueFromElement(eEpisodeDetails, "episode");
if (StringUtils.isNumeric(tempValue)) {
epDetail.setEpisode(Integer.parseInt(tempValue));
}
epDetail.setPlot(DOMHelper.getValueFromElement(eEpisodeDetails, "plot"));
tempValue = DOMHelper.getValueFromElement(eEpisodeDetails, "rating");
int rating = parseRating(tempValue);
if (rating > -1) {
// Looks like a valid rating
epDetail.setRating(String.valueOf(rating));
}
tempValue = DOMHelper.getValueFromElement(eEpisodeDetails, "aired");
if (isValidString(tempValue)) {
try {
epDetail.setFirstAired(DateTimeTools.convertDateToString(new DateTime(tempValue)));
} catch (Exception ignore) {
// Set the aired date if there is an exception
epDetail.setFirstAired(tempValue);
}
}
epDetail.setAirsAfterSeason(DOMHelper.getValueFromElement(eEpisodeDetails, "airsafterseason", "airsAfterSeason"));
epDetail.setAirsBeforeSeason(DOMHelper.getValueFromElement(eEpisodeDetails, "airsbeforeseason", "airsBeforeSeason"));
epDetail.setAirsBeforeEpisode(DOMHelper.getValueFromElement(eEpisodeDetails, "airsbeforeepisode", "airsBeforeEpisode"));
return epDetail;
}
示例12: getMjbGenerationDate
import org.pojava.datetime.DateTime; //导入依赖的package包/类
public DateTime getMjbGenerationDate() {
if (this.mjbGenerationDate == null) {
this.mjbGenerationDate = new DateTime();
}
return this.mjbGenerationDate;
}