本文整理了Java中org.joda.time.LocalDate.dayOfWeek()
方法的一些代码示例,展示了LocalDate.dayOfWeek()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LocalDate.dayOfWeek()
方法的具体详情如下:
包路径:org.joda.time.LocalDate
类名称:LocalDate
方法名:dayOfWeek
[英]Get the day of week property which provides access to advanced functionality.
[中]获取星期几属性,该属性提供对高级功能的访问。
代码示例来源:origin: stackoverflow.com
LocalDate today = new LocalDate();
LocalDate weekStart = today.dayOfWeek().withMinimumValue();
LocalDate weekEnd = today.dayOfWeek().withMaximumValue();
代码示例来源:origin: stackoverflow.com
LocalDate date = new LocalDate();
date = date.withDayOfWeek(2);
System.out.println(date.dayOfWeek().getAsText());
代码示例来源:origin: stackoverflow.com
LocalDate date = LocalDate.now();
String nameOfWeekday = date.dayOfWeek().getAsText(Locale.ENGLISH);
代码示例来源:origin: stackoverflow.com
LocalDate myDate = getSelectedDate();
return myDate.dayOfWeek().withMinimumValue();
代码示例来源:origin: stackoverflow.com
LocalDate startDate = new LocalDate(2012, 12, 2);
int day = startDate.dayOfWeek().get(); // gets the day of the week as integer
if (DateTimeConstants.SUNDAY == day) {
System.out.println("It's a Sunday!");
}
代码示例来源:origin: yannecer/NCalendar
public static LocalDate getMonFirstDayOfWeek(LocalDate date) {
return date.dayOfWeek().withMinimumValue();
}
代码示例来源:origin: stackoverflow.com
public static LocalDate getNearestDayOfWeek(LocalDate t0, String dow) {
return getNearestDayOfWeek(t0,t0.dayOfWeek().setCopy(dow).getDayOfWeek());
}
代码示例来源:origin: stackoverflow.com
LocalDate firstSundayOfJuly = new LocalDate(2013, 7, 1);
firstSundayOfJuly = firstSundayOfJuly.dayOfWeek().withMaximumValue();
Interval i = new Interval(LocalDate.now().toDateTimeAtStartOfDay(),
firstSundayOfJuly.toDateTimeAtStartOfDay());
System.out.println("days = " + i.toDuration().getStandardDays());
代码示例来源:origin: stackoverflow.com
public class Time {
public static void main(String[] args) {
System.out.println(getNthOfMonth(DateTimeConstants.SUNDAY, DateTimeConstants.SEP, 2012));
}
public static LocalDate getNthOfMonth(int day_of_week, int month, int year) {
LocalDate date = new LocalDate(year, month, 1).dayOfMonth()
.withMaximumValue()
.dayOfWeek()
.setCopy(day_of_week);
if(date.getMonthOfYear() != month) {
return date.dayOfWeek().addToCopy(-7);
}
return date;
}
}
代码示例来源:origin: stackoverflow.com
LocalDate date = new LocalDate();
date = date.withDayOfWeek( i + 1 ); // Add one to transform index into ordinal.
System.out.println( "There were " + days.get( i ) + " dates on " + date.dayOfWeek().getAsText() );
代码示例来源:origin: org.motechproject/motech-platform-commons-date
public static DayOfWeek getDayOfWeek(LocalDate date) {
return DayOfWeek.getDayOfWeek(date.dayOfWeek().get());
}
代码示例来源:origin: stackoverflow.com
LocalDate date = new LocalDate(YEAR, 1, 1);
while ( date.dayOfWeek() != 7 )
{
date = date.addDays(1);
}
while ( date.year() == YEAR )
{
date = date.addDays(7);
}
代码示例来源:origin: com.cronutils/htime
@VisibleForTesting
Map<String, String> initDaysOfWeek(Locale locale) {
String fullDoW =
String.format("%s%s%s%s",
constants.dayOfWeekName(), constants.dayOfWeekName(),
constants.dayOfWeekName(), constants.dayOfWeekName()
);
LocalDate date = new LocalDate();
Map<String, String> mapping = Maps.newHashMap();
for (int j = 1; j < 8; j++) {
String dow = date.withDayOfWeek(j).dayOfWeek().getAsText(locale).toLowerCase();
mapping.put(dow, fullDoW);
mapping.put(dow.substring(0, 3), constants.dayOfWeekName());
}
return mapping;
}
代码示例来源:origin: kiselev-dv/gazetteer
int dayOfWeek = dumpDate.dayOfWeek().get();
代码示例来源:origin: yannecer/NCalendar
public static LocalDate getSunFirstDayOfWeek(LocalDate date) {
if (date.dayOfWeek().get() == 7) {
return date;
} else {
return date.minusWeeks(1).withDayOfWeek(7);
}
}
代码示例来源:origin: yjjdick/sdb-mall
/**
* 根据周数,获取开始日期、结束日期
* @param week 周期 0本周,-1上周,-2上上周,1下周,2下下周
* @return 返回date[0]开始日期、date[1]结束日期
*/
public static Date[] getWeekStartAndEnd(int week) {
DateTime dateTime = new DateTime();
LocalDate date = new LocalDate(dateTime.plusWeeks(week));
date = date.dayOfWeek().withMinimumValue();
Date beginDate = date.toDate();
Date endDate = date.plusDays(6).toDate();
return new Date[]{beginDate, endDate};
}
代码示例来源:origin: 794147572/cloud
/**
* 根据周数,获取开始日期、结束日期
*
* @param week 周期 0本周,-1上周,-2上上周,1下周,2下下周
* @return 返回date[0]开始日期、date[1]结束日期
*/
public static Date[] getWeekStartAndEnd(int week) {
DateTime dateTime = new DateTime();
LocalDate date = new LocalDate(dateTime.plusWeeks(week));
date = date.dayOfWeek().withMinimumValue();
Date beginDate = date.toDate();
Date endDate = date.plusDays(6).toDate();
return new Date[]{beginDate, endDate};
}
代码示例来源:origin: TUM-Dev/Campus-Android
String weekday = localDate.dayOfWeek().getAsText(Locale.getDefault());
rv.setTextViewText(R.id.timetable_widget_weekday, weekday);
代码示例来源:origin: daniellitoc/xultimate-toolkit
.dayOfWeek() // Access Day Of Week Property
.setCopy("星期一") // Set to Monday (it will round down)
.plusDays(1); // Gives us Tuesday
代码示例来源:origin: googleads/aw-reporting
break;
case LAST_WEEK:
LocalDate.Property lastWeekProp = today.minusWeeks(1).dayOfWeek();
startDate = lastWeekProp.withMinimumValue();
endDate = lastWeekProp.withMaximumValue();
case THIS_WEEK_SUN_TODAY:
startDate = today.minusWeeks(1).dayOfWeek().withMaximumValue();
endDate = today;
break;
case THIS_WEEK_MON_TODAY:
startDate = today.dayOfWeek().withMinimumValue();
endDate = today;
break;
case LAST_WEEK_SUN_SAT:
startDate = today.minusWeeks(2).dayOfWeek().withMaximumValue();
endDate = today.minusWeeks(1).dayOfWeek().withMaximumValue().minusDays(1);
break;
内容来源于网络,如有侵权,请联系作者删除!