本文整理汇总了Java中org.joda.time.DateTime.getHourOfDay方法的典型用法代码示例。如果您正苦于以下问题:Java DateTime.getHourOfDay方法的具体用法?Java DateTime.getHourOfDay怎么用?Java DateTime.getHourOfDay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.joda.time.DateTime
的用法示例。
在下文中一共展示了DateTime.getHourOfDay方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateNewUploadId
import org.joda.time.DateTime; //导入方法依赖的package包/类
/**
* Creates a new uploadId from the time:
* format("%d-%02d-%02d %02d:%02d:%02d", year, month, day, hour, minute, seconds);
* @return
*/
public static String generateNewUploadId() {
java.util.Date juDate = new Date();
DateTime dt = new DateTime(juDate);
StringBuilder sb = new StringBuilder();
// Send all output to the Appendable object sb
Formatter formatter = new Formatter(sb);
int day = dt.getDayOfMonth();
int month = dt.getMonthOfYear();
int year = dt.getYear();
int hour = dt.getHourOfDay();
int minute = dt.getMinuteOfHour();
int seconds = dt.getSecondOfMinute();
formatter.format("%d-%02d-%02d %02d:%02d:%02d", year, month, day, hour, minute, seconds);
return sb.toString();
}
开发者ID:UMM-CSci-3601-S17,项目名称:digital-display-garden-iteration-4-revolverenguardia-1,代码行数:26,代码来源:ExcelParser.java
示例2: getAvailableUploadId
import org.joda.time.DateTime; //导入方法依赖的package包/类
public static String getAvailableUploadId(){
StringBuilder sb = new StringBuilder();
// Send all output to the Appendable object sb
Formatter formatter = new Formatter(sb);
java.util.Date juDate = new Date();
DateTime dt = new DateTime(juDate);
int day = dt.getDayOfMonth();
int month = dt.getMonthOfYear();
int year = dt.getYear();
int hour = dt.getHourOfDay();
int minute = dt.getMinuteOfHour();
int seconds = dt.getSecondOfMinute();
formatter.format("%d-%02d-%02d %02d:%02d:%02d", year, month, day, hour, minute, seconds);
return sb.toString();
}
开发者ID:UMM-CSci-3601-S17,项目名称:digital-display-garden-iteration-3-sixguysburgers-fries,代码行数:21,代码来源:ImageHandler.java
示例3: getAvailableUploadId
import org.joda.time.DateTime; //导入方法依赖的package包/类
public static String getAvailableUploadId(){
StringBuilder sb = new StringBuilder();
// Send all output to the Appendable object sb
Formatter formatter = new Formatter(sb);
java.util.Date juDate = new Date();
DateTime dt = new DateTime(juDate);
int day = dt.getDayOfMonth();
int month = dt.getMonthOfYear();
int year = dt.getYear();
int hour = dt.getHourOfDay();
int minute = dt.getMinuteOfHour();
int seconds = dt.getSecondOfMinute();
formatter.format("%d-%02d-%02d %02d:%02d:%02d", year, month, day, hour, minute, seconds);
allIds.add(sb.toString());
return sb.toString();
}
开发者ID:UMM-CSci-3601-S17,项目名称:digital-display-garden-iteration-3-sixguysburgers-fries,代码行数:22,代码来源:ExcelParser.java
示例4: getAvailableUploadID
import org.joda.time.DateTime; //导入方法依赖的package包/类
public static String getAvailableUploadID(){
StringBuilder sb = new StringBuilder();
// Send all output to the Appendable object sb
Formatter formatter = new Formatter(sb);
java.util.Date juDate = new Date();
DateTime dt = new DateTime(juDate);
int day = dt.getDayOfMonth();
int month = dt.getMonthOfYear();
int year = dt.getYear();
int hour = dt.getHourOfDay();
int minute = dt.getMinuteOfHour();
int seconds = dt.getSecondOfMinute();
formatter.format("%d-%02d-%02d %02d:%02d:%02d", year, month, day, hour, minute, seconds);
return sb.toString();
}
开发者ID:UMM-CSci-3601-S17,项目名称:digital-display-garden-iteration-4-dorfner-v2,代码行数:21,代码来源:ExcelParser.java
示例5: getTime
import org.joda.time.DateTime; //导入方法依赖的package包/类
@NonNull
private static String getTime(DateTime msgTime) {
int hourOfDay = msgTime.getHourOfDay();
String when;
if (hourOfDay >= 18) {//18-24
when = "晚上";
} else if (hourOfDay >= 13) {//13-18
when = "下午";
} else if (hourOfDay >= 11) {//11-13
when = "中午";
} else if (hourOfDay >= 5) {//5-11
when = "早上";
} else {//0-5
when = "凌晨";
}
return when + " " + msgTime.toString("hh:mm");
}
示例6: getNextTriggerTimeReturnsTheNextDateTimeOfTheHourAndMinute
import org.joda.time.DateTime; //导入方法依赖的package包/类
@Test
public void getNextTriggerTimeReturnsTheNextDateTimeOfTheHourAndMinute() {
DateTime now = DateTime.now();
int hour = (now.getHourOfDay() + 1) % 24;
int minute = (now.getMinuteOfHour() + 5) % 60;
Alarm alarm = new Alarm(context, podcast, hour, minute);
DateTime triggerTime = alarm.getNextTriggerTime();
assertEquals(hour, triggerTime.getHourOfDay());
assertEquals(minute, triggerTime.getMinuteOfHour());
assertEquals(0, triggerTime.getSecondOfMinute());
assertEquals(0, triggerTime.getMillisOfSecond());
assertTrue(triggerTime.isAfter(now));
}
示例7: getNextTriggerTimeReturnsTheNextDateTimeOfTheHourAndMinuteWhenThe
import org.joda.time.DateTime; //导入方法依赖的package包/类
@Test
public void getNextTriggerTimeReturnsTheNextDateTimeOfTheHourAndMinuteWhenThe() {
DateTime now = DateTime.now();
DateTime before = new DateTime(now).minusHours(1).minusMinutes(5);
Alarm alarm = new Alarm(context, podcast, before.getHourOfDay(), before.getMinuteOfHour());
DateTime triggerTime = alarm.getNextTriggerTime();
assertEquals(before.getHourOfDay(), triggerTime.getHourOfDay());
assertEquals(before.getMinuteOfHour(), triggerTime.getMinuteOfHour());
assertTrue(triggerTime.isAfter(now));
}
示例8: onCreateDialog
import org.joda.time.DateTime; //导入方法依赖的package包/类
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
DateTime currentDateTime = new DateTime();
int currentHour = currentDateTime.getHourOfDay();
int currentMinute = currentDateTime.getMinuteOfHour();
final Bundle args = getArguments();
MinTimePickerDialog timePickerDialog = new MinTimePickerDialog(getActivity(), R.style.MyPicker,
(view, hourOfDay, minute) -> {
DateTime dateTime = new DateTime(
args.getInt(ARGUMENT_PICKED_YEAR),
args.getInt(ARGUMENT_PICKED_MONTH) + 1,
args.getInt(ARGUMENT_PICKED_DAY), hourOfDay, minute);
EventBus.getDefault().post(new ReminderSetEvent(dateTime.getMillis()));
}, currentHour, currentMinute, DateFormat.is24HourFormat(getActivity()));
if (args.getBoolean(ARGUMENT_IS_TODAY)) {
timePickerDialog.setMin(currentHour, currentMinute);
}
return timePickerDialog;
}
示例9: incrementSageOneRequestCounter
import org.joda.time.DateTime; //导入方法依赖的package包/类
static boolean incrementSageOneRequestCounter(final int companyId) {
boolean response = true;
SageOneConstants.SAGE_ONE_REQUEST_COUNTER_DAY.put(companyId, SageOneConstants.SAGE_ONE_REQUEST_COUNTER_DAY.get(companyId) + 1);
SageOneConstants.SAGE_ONE_REQUEST_COUNTER_HOUR.put(companyId, SageOneConstants.SAGE_ONE_REQUEST_COUNTER_HOUR.get(companyId) + 1);
DateTime now = new DateTime();
if((SageOneConstants.SAGE_ONE_REQUEST_COUNTER_DAY.get(companyId) >= SageOneConstants.SAGE_ONE_REQUEST_LIMIT_DAY &&
SageOneConstants.CURRENT_DAY == now.getDayOfMonth())
|| (SageOneConstants.SAGE_ONE_REQUEST_COUNTER_HOUR.get(companyId) >= SageOneConstants.SAGE_ONE_REQUEST_LIMIT_HOUR &&
SageOneConstants.CURRENT_HOUR == now.getHourOfDay())) {
response = false;
resultLimitReached = true;
}
if(SageOneConstants.CURRENT_DAY != now.getDayOfMonth()) {
SageOneConstants.CURRENT_DAY = now.getDayOfMonth();
SageOneConstants.SAGE_ONE_REQUEST_COUNTER_DAY.put(companyId, 0);
}
if(SageOneConstants.CURRENT_HOUR != now.getHourOfDay()) {
SageOneConstants.CURRENT_HOUR = now.getHourOfDay();
SageOneConstants.SAGE_ONE_REQUEST_COUNTER_HOUR.put(companyId, 0);
}
return response;
}
示例10: format
import org.joda.time.DateTime; //导入方法依赖的package包/类
@Override
public String format(DateTime timestamp) {
int hourOfDay = timestamp.getHourOfDay() % 12;
if (hourOfDay == 0) {
hourOfDay = 12;
}
return zeroPadded(2, String.valueOf(hourOfDay));
}
示例11: parseDate
import org.joda.time.DateTime; //导入方法依赖的package包/类
public static long parseDate(String dateTime) {
DateTimeFormatter formatter = DateTimeFormat.forPattern("MM/dd hh:mm aa");
DateTime d = formatter.parseDateTime(dateTime);
DateTime dt = new DateTime(Calendar.getInstance().get(Calendar.YEAR), d.getMonthOfYear(), d.getDayOfMonth(), d.getHourOfDay(), d.getMinuteOfHour(), Constants.DATE.VEGAS_TIME_ZONE);
return dt.getMillis();
}
示例12: getHour
import org.joda.time.DateTime; //导入方法依赖的package包/类
/**
* 获取date对象小时数
* @param date
* @return
*/
public static int getHour(Date date) {
DateTime dt = new DateTime(date);
return dt.getHourOfDay();
}
示例13: getHour
import org.joda.time.DateTime; //导入方法依赖的package包/类
/**
* getHour
*
* @param date
* @return
*/
public static int getHour(Date date) {
DateTime dt = new DateTime(date);
return dt.getHourOfDay();
}