List of usage examples for org.joda.time DateTime getSecondOfMinute
public int getSecondOfMinute()
From source file:TimeDate.Time.java
public Time() { DateTime tmr = new DateTime(); this.hora = tmr.getHourOfDay(); this.minutos = tmr.getMinuteOfHour(); this.segundos = tmr.getSecondOfMinute(); }
From source file:uk.co.jassoft.markets.utils.article.ContentGrabber.java
private Date getDateValue(final String contentsToCheck) { if (contentsToCheck.isEmpty()) return null; Parser parser = new Parser(); List<DateGroup> groups = parser.parse(contentsToCheck); Date possibleDate = null;/*from w w w .ja v a 2 s .c om*/ for (DateGroup group : groups) { List<Date> dates = group.getDates(); for (Date publishedDate : dates) { if (new DateTime(DateTimeZone.UTC).plusDays(1).isBefore(publishedDate.getTime())) { LOG.debug("Date is over 1 day in the future [{}]", publishedDate.toString()); continue; } if (possibleDate == null) { possibleDate = publishedDate; if (group.isTimeInferred()) { possibleDate = new DateTime(publishedDate).withTime(0, 0, 0, 0).toDate(); } continue; } DateTime latestPublishedDate = new DateTime(publishedDate); if (!group.isTimeInferred()) { possibleDate = new DateTime(possibleDate).withTime(latestPublishedDate.getHourOfDay(), latestPublishedDate.getMinuteOfHour(), latestPublishedDate.getSecondOfMinute(), latestPublishedDate.getMillisOfSecond()).toDate(); } if (!group.isDateInferred()) { possibleDate = new DateTime(possibleDate).withDate(latestPublishedDate.getYear(), latestPublishedDate.getMonthOfYear(), latestPublishedDate.getDayOfMonth()).toDate(); } } } if (possibleDate != null) { return possibleDate; } return null; }