Java Code Examples for org.joda.time.DateTime#get()
The following examples show how to use
org.joda.time.DateTime#get() .
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: NaturalDateFormat File: AbsoluteDateFormat.java License: Apache License 2.0 | 6 votes |
@Override protected String formatDate(DateTime now, DateTime then) { if (dateFormat == null) buildDateFormat(); StringBuilder builder = new StringBuilder(); if (hasFormat(WEEKDAY) && now.get(omitWeekday) == then.get(omitWeekday)) builder.append(weekdayFormat.print(then)); if (hasFormat(DAYS | MONTHS)) { if (builder.length() > 0) builder.append(", "); builder.append(dateFormat.print(then)); } if (hasFormat(YEARS) && Years.yearsBetween(now, then).getYears() != 0) builder.append(yearFormat.print(then)); if (hasFormat(TIME) && now.get(omitTime) == then.get(omitTime)) { builder.append(", "); builder.append(formatTime(now, then)); } return builder.toString(); }
Example 2
Source Project: unitime File: QueryLog.java License: Apache License 2.0 | 5 votes |
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(); }