/** * Constructs a new {@code Date} initialized to the date and time parsed from the * specified String. * * @param string * the String to parse. * * @deprecated Use {@link DateFormat} instead. */ @Deprecated public Date(String string) { milliseconds = parse(string); }
/** * Returns the specified header value as a date in milliseconds since January * 1, 1970 GMT. Returns the {@code defaultValue} if no such header field * could be found. * * @param field * the header field name whose value is needed. * @param defaultValue * the default value if no field has been found. * @return the value of the specified header field as a date in * milliseconds. */ @SuppressWarnings("deprecation") public long getHeaderFieldDate(String field, long defaultValue) { String date = getHeaderField(field); if (date == null) { return defaultValue; } try { return Date.parse(date); // TODO: use HttpDate.parse() } catch (Exception e) { return defaultValue; } }
@SuppressWarnings("deprecation") public void setMediaCreateDate(String date) { try { setMediaCreateDate(new Date(Date.parse(date))); //Deprecated, but also the easiest way to do this quickly } catch (IllegalArgumentException e) { throw new RuntimeException("Unable to parse date '" + date + "'", e); } }
@SuppressWarnings("deprecation") public void setMediaModificationDate(String date) { setMediaModificationDate(new Date(Date.parse(date))); //Deprecated, but also the easiest way to do this quickly }
@SuppressWarnings("deprecation") public long getHeaderFieldDate(String field, long defaultValue) { String date = getHeaderField(field); if (date == null) { return defaultValue; } try { return Date.parse(date); } catch (Exception e) { return defaultValue; } }
@Override protected void handleOptionWithArgument(String option, String argument) throws IOException { if ("-name".equals(option)) { revisionName = argument; } else if ("-projectName".equals(option)) { projectName = argument; } else if ("-suppress".equals(option)) { exclusionFilterFile = argument; } else if ("-timestamp".equals(option)) { revisionTimestamp = Date.parse(argument); } else if ("-source".equals(option)) { sourcePaths.add(argument); } else if ("-lastVersion".equals(option)) { lastVersion = argument; } else if ("-findSource".equals(option)) { searchSourcePaths.add(argument); } else { throw new IllegalArgumentException("Can't handle option " + option); } }
* Integer.parseInt(val.substring(0, val.length() - 7)); } else { time = Date.parse(val);
rand = new Random(); date = new Date(); dateRange = Date.parse("Tue 1 May 2012 00:00:00"); // random date range dateForm = new SimpleDateFormat("yyyy-MM-dd");
String ifModifiedSince = t.getRequestHeaders().getFirst("If-Modified-Since"); if (ifModifiedSince != null) { long d = Date.parse(ifModifiedSince); if (d + 1000 >= lastModified) { Headers hds = t.getResponseHeaders();
Caused by: java.lang.IllegalArgumentException 04-20 09:21:32.553: ERROR/AndroidRuntime(838): at java.util.Date.parse(Date.java:447) 04-20 09:21:32.553: ERROR/AndroidRuntime(838): at java.util.Date.<init>(Date.java:157) 04-20 09:21:32.553: ERROR/AndroidRuntime(838): at winterwell.jtwitter.Twitter$Status.<init>(Twitter.java:659) 04-20 09:21:32.553: ERROR/AndroidRuntime(838): at winterwell.jtwitter.Twitter.updateStatus(Twitter.java:3231)
/** * Constructs a new {@code Date} initialized to the date and time parsed from the * specified String. * * @param string * the String to parse. * * @deprecated Use {@link DateFormat} instead. */ @Deprecated public Date(String string) { milliseconds = parse(string); }
/** * Constructs a new {@code Date} initialized to the date and time parsed from the * specified String. * * @param string * the String to parse. * * @deprecated Use {@link DateFormat} instead. */ @Deprecated public Date(String string) { milliseconds = parse(string); }
@SuppressWarnings("deprecation") @Override public Object decode(Class targetClass, Object val, MappedField optionalExtraInfo) throws MappingException { if (val == null) return null; if (val instanceof Date) return val; if (val instanceof Number) return new Date(((Number)val).longValue()); return new Date(Date.parse(val.toString())); // good luck } }
adapter.setViewBinder(new SimpleCursorAdapter.ViewBinder() { public boolean setViewValue(View view, Cursor cursor, int columnIndex) { if (view.getId() == R.id.swimm_date) { DateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); TextView tv = (TextView)view; tv.setText(sdf.format(java.util.Date.parse(cursor.getString(columnIndex)))); return true; }
@Override public long getDateHeader(String name) { String header = getHeader(name); if (header == null) return -1; return Date.parse(header); }
@Override @SuppressWarnings("deprecation") public long getTime(Access type) { if (WRITE != type) return UNKNOWN; try { final String field = getHeaderField("last-modified"); if (null != field) return Date.parse(field); } catch (IllegalArgumentException | IOException ex) { } return UNKNOWN; }
@Override public void formatValue(String fieldName, Pair<String, String> pair, boolean caseSensitive) { if (CREATION_DATE.equals(fieldName)) { Date tmp = new Date(Date.parse(StringHelper.trim(pair.getSecond(), '\''))); pair.setSecond(StringFormat.format("'%1$s'", tmp)); } else { super.formatValue(fieldName, pair, caseSensitive); } } }
@SuppressWarnings("deprecation") public static long parse(String s) { Capturer.capture(Instrumenter.CAPTURE_ID_JAVA_UTIL_DATE, CaptureUtil.loadClass("java/util/Date"), "parse", "(Ljava/lang/String;)J", new Object[] {s}); long ret = java.util.Date.parse(s); Capturer.enable(Instrumenter.CAPTURE_ID_JAVA_UTIL_DATE, CaptureUtil.loadClass("java/util/Date"), ret); return ret; }