List of usage examples for org.joda.time DateTime parse
@FromString public static DateTime parse(String str)
From source file:com.hp.autonomy.hod.client.api.queryprofile.QueryProfileName.java
License:MIT License
private QueryProfileName(final Builder builder) { this.name = builder.name; this.dateCreated = DateTime.parse(builder.dateCreated); }
From source file:com.ibm.common.activitystreams.util.Converters.java
License:Apache License
/** * Method tryParseDateTime.// w w w . j ava 2s . c o m * @param input String * @return DateTime */ private static DateTime tryParseDateTime(String input) { try { return DateTime.parse(input); } catch (Throwable t) { return null; } }
From source file:com.jive.myco.seyren.api.util.DateTimeParam.java
License:Apache License
public DateTimeParam(String value) { if (StringUtils.isEmpty(value)) { this.value = null; } else {/* w ww . ja va 2s. c om*/ this.value = DateTime.parse(value); } }
From source file:com.money.manager.ex.investment.EditPriceDialog.java
License:Open Source License
@Override @NonNull//from w w w. j av a2 s.c o m public Dialog onCreateDialog(Bundle savedInstanceState) { if (savedInstanceState != null) { restoreInstanceState(savedInstanceState); } else { mAccountId = getArguments().getInt(ARG_ACCOUNT); String symbol = getArguments().getString(ARG_SYMBOL); Money price = MoneyFactory.fromString(getArguments().getString(ARG_PRICE)); String dateString = getArguments().getString(ARG_DATE); DateTime date = DateTime.parse(dateString); mPrice = new PriceDownloadedEvent(symbol, price, date); } // Create binaryDialog. AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(getContext()).setTitle(mPrice.symbol) .setIcon(FontIconDrawable.inflate(getContext(), R.xml.ic_euro)); View viewDialog = LayoutInflater.from(getContext()).inflate(R.layout.dialog_edit_stock_price, null); builder.setView(viewDialog); viewHolder = new EditPriceViewHolder(viewDialog); initializeControls(viewHolder); // actions builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { //update price StockRepository repo = new StockRepository(getContext()); repo.updateCurrentPrice(mPrice.symbol, mPrice.price); StockHistoryRepository historyRepository = new StockHistoryRepository(getContext()); boolean result = historyRepository.addStockHistoryRecord(mPrice); if (!result) { Toast.makeText(getContext(), getContext().getString(R.string.error_update_currency_exchange_rate), Toast.LENGTH_SHORT).show(); } new SyncManager(getContext()).dataChanged(); } }); builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); showDate(); showCurrentPrice(); return builder.create(); }
From source file:com.money.manager.ex.sync.SyncManager.java
License:Open Source License
public boolean isRemoteFileModified(CloudMetaData remoteFile) { DateTime cachedLastModified = DateTime.parse(getDatabases().getCurrent().remoteLastChangedDate); DateTime remoteLastModified = getModificationDateFrom(remoteFile); return !remoteLastModified.isEqual(cachedLastModified); }
From source file:com.nononsenseapps.feeder.db.FeedItemSQL.java
License:Open Source License
/** * Set the date time in ISO8601 format (yyyy-MM-ddTHH:mm:ss.SSSZZ). *///w w w . ja v a 2 s . co m public void setPubDate(String datetime) { if (datetime == null) { pubDate = null; } else { try { pubDate = DateTime.parse(datetime); } catch (Throwable e) { Log.e(tag, "Couldn't parse date: " + datetime + ";" + e); pubDate = null; } } }
From source file:com.nononsenseapps.feeder.db.FeedItemSQL.java
License:Open Source License
/** * Parse a timestamp and return what should be set on the database item. * @param datetime a timestamp to parse. Allowed to be null * @return null, or valid timestamp/*from ww w .j a va2 s. co m*/ */ public static String getPubDateFromString(String datetime) { if (datetime == null) { return null; } try { return DateTime.parse(datetime).toString(); } catch (Exception e) { return DateTime.now().toString(); } }
From source file:com.norconex.collector.http.sitemap.impl.DefaultSitemapResolver.java
License:Open Source License
private void parseCharacters(ParseState parseState, String value) { if (parseState.loc) { parseState.baseURL.setUrl(value); parseState.loc = false;//from w ww .java2 s . c o m } else if (parseState.lastmod) { try { parseState.baseURL.setSitemapLastMod(DateTime.parse(value).getMillis()); } catch (Exception e) { LOG.info("Invalid sitemap date: " + value); } parseState.lastmod = false; } else if (parseState.changefreq) { parseState.baseURL.setSitemapChangeFreq(value); parseState.changefreq = false; } else if (parseState.priority) { try { parseState.baseURL.setSitemapPriority(Float.parseFloat(value)); } catch (NumberFormatException e) { LOG.info("Invalid sitemap priority: " + value); } parseState.priority = false; } }
From source file:com.norconex.collector.http.sitemap.impl.StandardSitemapResolver.java
License:Apache License
private void parseCharacters(ParseState parseState, String value) { if (parseState.loc) { parseState.baseURL.setReference(value); parseState.loc = false;/*w w w .j ava2s .co m*/ } else if (parseState.lastmod) { try { parseState.baseURL.setSitemapLastMod(DateTime.parse(value).getMillis()); } catch (Exception e) { LOG.info("Invalid sitemap date: " + value); } parseState.lastmod = false; } else if (parseState.changefreq) { parseState.baseURL.setSitemapChangeFreq(value); parseState.changefreq = false; } else if (parseState.priority) { try { parseState.baseURL.setSitemapPriority(Float.parseFloat(value)); } catch (NumberFormatException e) { LOG.info("Invalid sitemap priority: " + value); } parseState.priority = false; } }
From source file:com.proofpoint.event.collector.Event.java
License:Apache License
@JsonCreator private static Event fromJson(@JsonProperty("type") String type, @JsonProperty("uuid") String uuid, @JsonProperty("host") String host, @JsonProperty("timestamp") String timestamp, @JsonProperty("data") Map<String, ?> data) { return new Event(type, uuid, host, DateTime.parse(timestamp), data); }