本文整理匯總了Java中org.joda.time.DateTime.get方法的典型用法代碼示例。如果您正苦於以下問題:Java DateTime.get方法的具體用法?Java DateTime.get怎麽用?Java DateTime.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.joda.time.DateTime
的用法示例。
在下文中一共展示了DateTime.get方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onDateTimePicked
import org.joda.time.DateTime; //導入方法依賴的package包/類
@Override
public void onDateTimePicked(DateTime d) {
searchDateTime = d;
DateTime now = new DateTime();
DateTimeFormatter df = DateTimeFormat.forPattern("dd MMMM yyyy");
DateTimeFormatter tf = DateTimeFormat.forPattern("HH:mm");
String day = df.print(searchDateTime);
String time = tf.print(searchDateTime);
String at = getActivity().getResources().getString(R.string.time_at);
if (now.get(DateTimeFieldType.year()) == searchDateTime.get(DateTimeFieldType.year())) {
if (now.get(DateTimeFieldType.dayOfYear()) == searchDateTime.get(DateTimeFieldType.dayOfYear())) {
day = getActivity().getResources().getString(R.string.time_today);
} else //noinspection RedundantCast
if (now.get(DateTimeFieldType.dayOfYear()) + 1 == (int) searchDateTime.get(DateTimeFieldType.dayOfYear())) {
day = getActivity().getResources().getString(R.string.time_tomorrow);
}
}
vDatetime.setText(day + " " + at + " " + time);
}
示例2: axe
import org.joda.time.DateTime; //導入方法依賴的package包/類
public String axe(DateTime now) {
SimpleDateFormat format = new SimpleDateFormat(iAxeFormat, Localization.getJavaLocale());
DateTime dt = getFirst(now);
int i = 0;
StringBuffer ret = new StringBuffer();
while (dt != null) {
if (i > 0) ret.append("|");
if ((dt.get(iAxeType) % iAxeMod) == iAxeValue)
ret.append(format.format(dt.getMillis()));
i++;
dt = next(dt, now);
}
return ret.toString();
}