List of usage examples for org.joda.time DateTime toString
public String toString(String pattern)
From source file:com.spears.objects.io.DatedFileAppenderImpl.java
License:Open Source License
private static String generateFilename(String rootpath) { String filename;//from w ww . j ava 2s .c om DateTime date = new DateTime(); int ver = 1; do { filename = String.format("%s/%d/%d/%d/LOG_%s_(%d).log", rootpath, date.getYear(), date.getMonthOfYear(), date.getDayOfMonth(), date.toString(DateTimeFormat.forPattern("MM-dd-yyyy_HH.mm")), ver); ver++; } while (new File(filename).exists()); return filename; }
From source file:com.spears.platforms.sub.subAuto.SubAutonomousCode.java
License:Open Source License
private String generateFilepath() { DateTime date = new DateTime(); return String.format("%s/%s_%s.log", DatedFileAppenderImpl.Log_File_Name, subName, date.toString(DateTimeFormat.forPattern("MM-dd-yyyy_HH.mm"))); }
From source file:com.spears.ui.implementation.EmbeddedDesktop.java
License:Open Source License
@Override public void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(Color.GRAY);//w w w . j a v a 2 s. co m final int margin = 10; if (isOpaque()) { if (hasImage) { try { g.drawImage(background.getImage(), (this.getWidth() - background.getIconWidth()) / 2, (this.getHeight() - background.getIconHeight()) / 2, null); } catch (Exception e) { e.printStackTrace(); } } g.drawString("Version: " + Globals.versionNumber, margin, getHeight() - 60); g.drawString("Developed by:", margin, getHeight() - 45); g.drawString("Van Bossuyt Group", margin, getHeight() - 30); g.drawString("Colorado School of Mines", margin, getHeight() - 15); DateTime real = DateTime.now(); final int space = (int) g.getFontMetrics().getStringBounds(" MM/DD/YYYY ", g).getWidth(); String time = real.toString("hh:mm aa"); g.drawString(time, getWidth() - (((int) g.getFontMetrics().getStringBounds(time, g).getWidth() + space) / 2 + margin), getHeight() - 30); String date = real.toString("MM/dd/yyyy"); g.drawString(date, getWidth() - (((int) g.getFontMetrics().getStringBounds(date, g).getWidth() + space) / 2 + margin), getHeight() - 15); } if (resizing) { g.drawRect((int) (dividing_line * getWidth()) - 1, 0, 2, getHeight()); } }
From source file:com.spectralogic.ds3cli.views.json.CommonJsonView.java
License:Open Source License
static CommonJsonView newView(final Status status) { final CommonJsonView view = new CommonJsonView(); final DateTime time = DateTime.now(DateTimeZone.UTC); return view.status(status).addMetaData("Date", time.toString(ISODateTimeFormat.dateTime())); }
From source file:com.thoughtworks.go.server.service.BackupService.java
License:Apache License
private File getBackupDir(DateTime backupTime) { return new File(backupLocation(), BACKUP + backupTime.toString("YYYYMMdd-HHmmss")); }
From source file:com.thoughtworks.xstream.converters.extended.ISO8601GregorianCalendarConverter.java
License:Open Source License
public String toString(Object obj) { DateTime dt = new DateTime(obj); return dt.toString(formattersUTC[0]); }
From source file:com.thoughtworks.xstream.core.util.ISO8601JodaTimeConverter.java
License:Open Source License
@Override public String toString(final Object obj) { final DateTime dt = new DateTime(obj); return dt.toString(formattersUTC[0]); }
From source file:com.threewks.thundr.google.analytics.admin.AnalyticsController.java
License:Apache License
public HandlebarsView analytics(List<String> metrics, List<String> dimensions, String from, String to) { DateTime fromDate = parseFromDate(from); DateTime toDate = parseToDate(to);/*from w w w .j a v a2 s . c o m*/ GaData results = fetchAnalytics(parseMetrics(metrics), parseDimensions(dimensions), fromDate, toDate); Map<String, Object> model = new HashMap<String, Object>(); // result data model.put("headers", results.getColumnHeaders()); model.put("results", results.getRows()); // reference data model.put("metrics", Metric.metrics); model.put("dimensions", Dimension.dimensions); // selections model.put("from", fromDate.toString(formatter)); model.put("to", toDate.toString(formatter)); return new HandlebarsView("/com/threewks/thundr/google/analytics/analytics.hbs", model); }
From source file:com.tmathmeyer.sentinel.ui.DatePicker.java
License:Open Source License
/** * Make the date field display the selected date. *//*from w ww .j av a2 s . co m*/ public void display(DateTime value) { this.miniCalendarInstance(false); if (this.cal != null) { this.cal.setVisible(false); } if (this.date != null) { date.setText(value.toString(dateFmt)); } if (linked != null) { linked.display(value); } }
From source file:com.tmathmeyer.sentinel.ui.DatePicker.java
License:Open Source License
/** * Sets date and time of DatePicker to specified value * /*from w w w .j a va 2s. co m*/ * @param previous the DateTime object from which to obtain values */ public void setDateTime(DateTime previous) { this.date.setValue(previous.toString(dateFmt)); this.time.setValue(previous.toString(timeFmt)); if (previous.getHourOfDay() >= 12) { this.AMPM.setSelectedIndex(1); } else { this.AMPM.setSelectedIndex(0); } }