本文整理了Java中org.joda.time.DateTime.getWeekOfWeekyear()
方法的一些代码示例,展示了DateTime.getWeekOfWeekyear()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DateTime.getWeekOfWeekyear()
方法的具体详情如下:
包路径:org.joda.time.DateTime
类名称:DateTime
方法名:getWeekOfWeekyear
暂无
代码示例来源:origin: prestodb/presto
assertFunction("extract(year_of_week FROM " + TIMESTAMP_LITERAL + ")", BIGINT, 2001L);
assertFunction("extract(doy FROM " + TIMESTAMP_LITERAL + ")", BIGINT, (long) TIMESTAMP.getDayOfYear());
assertFunction("extract(week FROM " + TIMESTAMP_LITERAL + ")", BIGINT, (long) TIMESTAMP.getWeekOfWeekyear());
assertFunction("extract(month FROM " + TIMESTAMP_LITERAL + ")", BIGINT, (long) TIMESTAMP.getMonthOfYear());
assertFunction("extract(quarter FROM " + TIMESTAMP_LITERAL + ")", BIGINT, (long) TIMESTAMP.getMonthOfYear() / 4 + 1);
assertFunction("extract(day_of_year FROM " + WEIRD_TIMESTAMP_LITERAL + ")", BIGINT, (long) WEIRD_TIMESTAMP.getDayOfYear());
assertFunction("extract(doy FROM " + WEIRD_TIMESTAMP_LITERAL + ")", BIGINT, (long) WEIRD_TIMESTAMP.getDayOfYear());
assertFunction("extract(week FROM " + WEIRD_TIMESTAMP_LITERAL + ")", BIGINT, (long) WEIRD_TIMESTAMP.getWeekOfWeekyear());
assertFunction("extract(month FROM " + WEIRD_TIMESTAMP_LITERAL + ")", BIGINT, (long) WEIRD_TIMESTAMP.getMonthOfYear());
assertFunction("extract(quarter FROM " + WEIRD_TIMESTAMP_LITERAL + ")", BIGINT, (long) WEIRD_TIMESTAMP.getMonthOfYear() / 4 + 1);
代码示例来源:origin: apache/phoenix
@Override
public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) {
Expression expression = getChildExpression();
if (!expression.evaluate(tuple, ptr)) {
return false;
}
if ( ptr.getLength() == 0) {
return true; //means null
}
long dateTime = inputCodec.decodeLong(ptr, expression.getSortOrder());
DateTime dt = new DateTime(dateTime);
int week = dt.getWeekOfWeekyear();
PDataType returnType = getDataType();
byte[] byteValue = new byte[returnType.getByteSize()];
returnType.getCodec().encodeInt(week, byteValue, 0);
ptr.set(byteValue);
return true;
}
代码示例来源:origin: org.modeshape/modeshape-graph
/**
* {@inheritDoc}
*/
public int getWeekOfWeekyear() {
return this.instance.getWeekOfWeekyear();
}
代码示例来源:origin: org.apache.isis.core/isis-core-applib
public boolean sameWeekAs(final DateTime dateTime2) {
return dateTime2 == null ? false : dateTime.getWeekOfWeekyear() == dateTime2.dateTime.getWeekOfWeekyear();
}
代码示例来源:origin: se.vgregion.oppna-program-notessystem/oppna-program-notessystem-calendar-composite-types
public Integer getWeekOfIntervalStart() {
return startDate.getWeekOfWeekyear();
}
代码示例来源:origin: stackoverflow.com
DateTime now = DateTime.now( DateTimeZone.forID( "America/Montreal" ) );
String output = ISODateTimeFormat.weekyearWeek().print( now );
int weekNumber = now.getWeekOfWeekyear();
代码示例来源:origin: te-con/ehour
/**
* Get week number for date but compensate with configured first day of week.
* Week officially starts on monday but when it's configured to start on sunday we have to compensate
* because the day falls in the previous week.
*/
public static int getWeekNumberForDate(Date date, int configuredFirstDayOfWeek) {
DateTime dateTime = new DateTime(date);
return configuredFirstDayOfWeek == Calendar.SUNDAY ? dateTime.plusDays(1).getWeekOfWeekyear() : dateTime.getWeekOfWeekyear();
}
代码示例来源:origin: org.wicketstuff/ddcalendar
public boolean isInWeek(DateTime date) {
return date.getWeekOfWeekyear() == week && date.getYear() == year;
}
}
代码示例来源:origin: Baralga/baralga
@Override
public int hashCode() {
return Objects.hashCode(
week.getYear(),
week.getWeekOfWeekyear()
);
}
代码示例来源:origin: stackoverflow.com
public static Date parseYearWeek(String yearWeek) {
DateTime dateTime = DateTimeFormat.forPattern("yy/ww").parseDateTime(yearWeek);
if (dateTime.getWeekOfWeekyear() == 1 && dateTime.getMonthOfYear() == 12) {
dateTime = DateTimeFormat.forPattern("yyyy/mm").parseDateTime((dateTime.getYear() + 1) + "/01");
}
return dateTime.toDate();
}
代码示例来源:origin: ywwynm/EverythingDone
public HabitRecord(long habitId, long habitReminderId, long recordTime) {
this.id = 0;
this.habitId = habitId;
this.habitReminderId = habitReminderId;
this.recordTime = recordTime;
DateTime dt = new DateTime(recordTime);
this.recordYear = dt.getYear();
this.recordMonth = dt.getMonthOfYear();
this.recordWeek = dt.getWeekOfWeekyear();
this.recordDay = dt.getDayOfMonth();
this.type = TYPE_FINISHED;
}
代码示例来源:origin: ywwynm/EverythingDone
public HabitRecord(long habitId, long habitReminderId) {
this.id = 0;
this.habitId = habitId;
this.habitReminderId = habitReminderId;
this.recordTime = System.currentTimeMillis();
DateTime dt = new DateTime(recordTime);
this.recordYear = dt.getYear();
this.recordMonth = dt.getMonthOfYear();
this.recordWeek = dt.getWeekOfWeekyear();
this.recordDay = dt.getDayOfMonth();
this.type = TYPE_FINISHED;
}
代码示例来源:origin: dhis2/dhis2-core
@Override
public int isoWeek( DateTimeUnit dateTimeUnit )
{
DateTime dateTime = dateTimeUnit.toJodaDateTime( chronology );
return dateTime.getWeekOfWeekyear();
}
代码示例来源:origin: jorgegil96/All-NBA
/**
* Returns the current week of the year (1-52).
*/
public static String getWeekForHighlights() {
DateTime dateTime = new DateTime(DateTimeZone.forTimeZone(
TimeZone.getTimeZone("America/New_York")));
return String.valueOf(dateTime.getWeekOfWeekyear());
}
}
代码示例来源:origin: sulo61/HorizontalExpandableCalendar-Android
public static boolean isTheSameWeek(DateTime dateTime1, DateTime dateTime2) {
DateTime firstDateMovedByFirstDayOfWeek = dateTime1.minusDays(firstDayOffset());
DateTime secondDateMovedByFirstDayOfWeek = dateTime2.minusDays(firstDayOffset());
return (firstDateMovedByFirstDayOfWeek.getYear() == secondDateMovedByFirstDayOfWeek.getYear()) &&
(firstDateMovedByFirstDayOfWeek.getWeekOfWeekyear() == secondDateMovedByFirstDayOfWeek.getWeekOfWeekyear());
}
代码示例来源:origin: org.jruby/jruby-complete
@JRubyMethod
public RubyInteger cweek(ThreadContext context) {
return RubyFixnum.newFixnum(context.runtime, dt.getWeekOfWeekyear());
}
代码示例来源:origin: org.jruby/jruby-core
@JRubyMethod
public RubyInteger cweek(ThreadContext context) {
return RubyFixnum.newFixnum(context.runtime, dt.getWeekOfWeekyear());
}
代码示例来源:origin: org.apache.pig/pig
@Override
public Integer exec(Tuple input) throws IOException {
if (input == null || input.size() < 1 || input.get(0) == null) {
return null;
}
return ((DateTime) input.get(0)).getWeekOfWeekyear();
}
代码示例来源:origin: jrkinley/storm-hbase
@Override
public void execute(TridentTuple tuple, TridentCollector collector) {
String monthly = tuple.getString(1).substring(0, 6);
Integer week = dtf.parseDateTime(tuple.getString(1)).getWeekOfWeekyear();
String weekly = tuple.getString(1).substring(0, 4)
.concat(week.toString());
collector.emit(new Values(cfStatsDaily, tuple.getString(1)));
collector.emit(new Values(cfStatsMonthly, monthly));
collector.emit(new Values(cfStatsWeekly, weekly));
}
}
代码示例来源:origin: dhis2/dhis2-core
@Override
public int isoWeek( DateTimeUnit dateTimeUnit )
{
DateTime dateTime = toIso( dateTimeUnit )
.toJodaDateTime( ISOChronology.getInstance( DateTimeZone.getDefault() ) );
return dateTime.getWeekOfWeekyear();
}
内容来源于网络,如有侵权,请联系作者删除!