List of usage examples for org.joda.time DateTime getYear
public int getYear()
From source file:org.encuestame.mvc.view.PollRssFeedView.java
License:Apache License
@Override protected Channel newFeed() { final Channel channel = new Channel("rss_2.0"); channel.setPubDate(new Date()); channel.setDescription("RSS Description"); channel.setTitle("Poll Published"); channel.setLink(""); final DateTime time = new DateTime(); channel.setCopyright(String.valueOf(time.getYear())); channel.setPubDate(time.toDate());/*from ww w .j a v a 2 s . c om*/ return channel; }
From source file:org.encuestame.mvc.view.ProfileRssFeedView.java
License:Apache License
@Override protected Channel newFeed() { final Channel channel = new Channel("rss_2.0"); channel.setPubDate(new Date()); channel.setDescription("User Profile Last Published Items"); channel.setTitle("Profile Last Published Items"); channel.setLink("link"); final DateTime time = new DateTime(); channel.setCopyright(String.valueOf(time.getYear())); channel.setPubDate(time.toDate());// w ww. ja v a2 s .c om return channel; }
From source file:org.encuestame.mvc.view.ProjectRssFeedView.java
License:Apache License
@Override protected Channel newFeed() { final Channel channel = new Channel("rss_2.0"); channel.setPubDate(new Date()); channel.setDescription("RSS Description"); channel.setTitle("Project published"); final DateTime time = new DateTime(); channel.setCopyright(String.valueOf(time.getYear())); channel.setPubDate(time.toDate());//from w ww . j av a 2 s . com return channel; }
From source file:org.encuestame.mvc.view.TweetPollRssFeedView.java
License:Apache License
@Override protected Channel newFeed() { final Channel channel = new Channel("rss_2.0"); channel.setPubDate(new Date()); channel.setDescription("TweetPoll Last Items Published"); channel.setTitle("TweetPoll Last Items Published"); final DateTime time = new DateTime(); channel.setLink(""); channel.setCopyright(String.valueOf(time.getYear())); channel.setPubDate(time.toDate());/*from ww w . jav a 2s . c o m*/ return channel; }
From source file:org.envirocar.analyse.categories.DEBasedCategory.java
License:Apache License
@Override public void updateTimeZone(DateTime trackTime) { int moy = trackTime.getMonthOfYear(); String utcOffset;//from w w w.jav a 2s .c om if (moy > 3 && moy < 10) { utcOffset = "+02:00"; } else if (moy < 3 || moy > 10) { utcOffset = "+01:00"; } else if (moy == 3) { DateTime lastSundayOfMarch = new DateTime(getLastSundayOfMarch(trackTime.getYear()), DateTimeZone.forOffsetHours(1)).plusHours(1); logger.info("lastSundayOfMarch: " + lastSundayOfMarch.toString()); logger.info("trackTime: " + trackTime.toString()); if (trackTime.isBefore(lastSundayOfMarch)) { utcOffset = "+01:00"; } else { utcOffset = "+02:00"; } } else if (moy == 10) { DateTime lastSundayOfMarch = new DateTime(getLastSundayOfOctober(trackTime.getYear()), DateTimeZone.forOffsetHours(2)).plusHours(3); if (trackTime.isBefore(lastSundayOfMarch)) { utcOffset = "+02:00"; } else { utcOffset = "+01:00"; } } else { utcOffset = "+01:00"; } this.timeZone = DateTimeZone.forID(utcOffset); }
From source file:org.epics.archiverappliance.common.TimeUtils.java
public static YearSecondTimestamp convertToYearSecondTimestamp(java.sql.Timestamp ts) { DateTime dateTime = new DateTime(ts.getTime(), DateTimeZone.UTC); DateTime startoftheYear = new DateTime(dateTime.getYear(), 1, 1, 0, 0, 0, 0, DateTimeZone.UTC); long startOfYearInSeconds = startoftheYear.getMillis() / 1000; long epochSeconds = dateTime.getMillis() / 1000; assert ((epochSeconds - startOfYearInSeconds) < Integer.MAX_VALUE); int secondsIntoYear = (int) (epochSeconds - startOfYearInSeconds); return new YearSecondTimestamp((short) (dateTime.getYear()), secondsIntoYear, ts.getNanos()); }
From source file:org.epics.archiverappliance.common.TimeUtils.java
public static YearSecondTimestamp convertToYearSecondTimestamp(gov.aps.jca.dbr.TimeStamp jcats) { DateTime dateTime = new DateTime((jcats.secPastEpoch() + EPICS_EPOCH_2_JAVA_EPOCH_OFFSET) * 1000, DateTimeZone.UTC);/* w ww.j a v a2 s . c om*/ DateTime startoftheYear = new DateTime(dateTime.getYear(), 1, 1, 0, 0, 0, 0, DateTimeZone.UTC); long startOfYearInSeconds = startoftheYear.getMillis() / 1000; long epochSeconds = dateTime.getMillis() / 1000; assert ((epochSeconds - startOfYearInSeconds) < Integer.MAX_VALUE); int secondsIntoYear = (int) (epochSeconds - startOfYearInSeconds); return new YearSecondTimestamp((short) (dateTime.getYear()), secondsIntoYear, (int) jcats.nsec()); }
From source file:org.epics.archiverappliance.common.TimeUtils.java
public static YearSecondTimestamp convertToYearSecondTimestamp(long epochSeconds) { DateTime dateTime = new DateTime(epochSeconds * 1000, DateTimeZone.UTC); DateTime startoftheYear = new DateTime(dateTime.getYear(), 1, 1, 0, 0, 0, 0, DateTimeZone.UTC); long startOfYearInSeconds = startoftheYear.getMillis() / 1000; assert ((epochSeconds - startOfYearInSeconds) < Integer.MAX_VALUE); int secondsIntoYear = (int) (epochSeconds - startOfYearInSeconds); return new YearSecondTimestamp((short) (dateTime.getYear()), secondsIntoYear, 0); }
From source file:org.epics.archiverappliance.common.TimeUtils.java
public static long getStartOfCurrentYearInSeconds() { DateTime now = new DateTime(DateTimeZone.UTC); DateTime startoftheYear = new DateTime(now.getYear(), 1, 1, 0, 0, 0, 0, DateTimeZone.UTC); return startoftheYear.getMillis() / 1000; }
From source file:org.epics.archiverappliance.common.TimeUtils.java
public static long getStartOfYearInSeconds(long epochseconds) { // The JODA DateTime constructor takes millis DateTime dateTime = new DateTime(epochseconds * 1000, DateTimeZone.UTC); DateTime startoftheYear = new DateTime(dateTime.getYear(), 1, 1, 0, 0, 0, 0, DateTimeZone.UTC); return startoftheYear.getMillis() / 1000; }