public static Date fromJsonDate( String string ) { return fromJsonDate( FastStringUtils.toCharArray(string), 0, string.length() ); }
public static Date fromJsonDate(String string) { return fromJsonDate(FastStringUtils.toCharArray(string), 0, string.length()); }
public static long toLong(Object obj, final long longDefault) { if (obj instanceof Long) { return (Long) obj; } if (obj instanceof Number) { return ((Number) obj).longValue(); } else if (obj instanceof CharSequence) { String str = Str.toString(obj); if (Dates.isJsonDate(str)) { return Dates.fromJsonDate(str).getTime(); } try { return StringScanner.parseLong(str); } catch (Exception ex) { return longDefault; } } else if (obj instanceof Date) { return ((Date) obj).getTime(); } else { return toInt(obj); } }
public static long toLong(Object obj, final long longDefault) { if (obj instanceof Long) { return (Long) obj; } if (obj instanceof Number) { return ((Number) obj).longValue(); } else if (obj instanceof CharSequence) { String str = Str.toString(obj); if (Dates.isJsonDate(str)) { return Dates.fromJsonDate(str).getTime(); } try { return StringScanner.parseLong(str); } catch (Exception ex) { return longDefault; } } else if (obj instanceof Date) { return ((Date) obj).getTime(); } else { return toInt(obj); } }
public static Date fromISO8601DateLoose( char[] buffer, int startIndex, int endIndex ) { if ( Dates.isISO8601QuickCheck( buffer, startIndex, endIndex ) ) { if ( Dates.isJsonDate( buffer, startIndex, endIndex ) ) { return Dates.fromJsonDate( buffer, startIndex, endIndex ); } else if ( Dates.isISO8601( buffer, startIndex, endIndex ) ) { return Dates.fromISO8601( buffer, startIndex, endIndex ); } else { try { return looseParse( buffer, startIndex, endIndex ); } catch ( Exception ex ) { throw new IllegalStateException( "unable to do a loose parse", ex ); } } } else { try { return looseParse( buffer, startIndex, endIndex ); } catch ( Exception ex ) { throw new IllegalStateException( "unable to do a loose parse", ex ); } } }
public static Date fromISO8601DateLoose(char[] buffer, int startIndex, int endIndex) { if (Dates.isISO8601QuickCheck(buffer, startIndex, endIndex)) { if (Dates.isJsonDate(buffer, startIndex, endIndex)) { return Dates.fromJsonDate(buffer, startIndex, endIndex); } else if (Dates.isISO8601(buffer, startIndex, endIndex)) { return Dates.fromISO8601(buffer, startIndex, endIndex); } else { try { return looseParse(buffer, startIndex, endIndex); } catch (Exception ex) { throw new IllegalStateException("unable to do a loose parse", ex); } } } else { try { return looseParse(buffer, startIndex, endIndex); } catch (Exception ex) { throw new IllegalStateException("unable to do a loose parse", ex); } } }
@Override public Date dateValue () { if ( type == TypeType.STRING ) { if ( Dates.isISO8601QuickCheck ( buffer, startIndex, endIndex ) ) { if ( Dates.isJsonDate ( buffer, startIndex, endIndex ) ) { return Dates.fromJsonDate ( buffer, startIndex, endIndex ); } else if ( Dates.isISO8601Jackson(buffer, startIndex, endIndex) ) { return Dates.fromISO8601Jackson(buffer, startIndex, endIndex); } else if ( Dates.isISO8601 ( buffer, startIndex, endIndex ) ) { return Dates.fromISO8601 ( buffer, startIndex, endIndex ); } else { throw new IllegalStateException( "Unable to convert " + stringValue () + " to date " ); } } else { throw new IllegalStateException ( "Unable to convert " + stringValue () + " to date " ); } } else { return new Date ( Dates.utc ( longValue () ) ); } }
@Override public Date dateValue () { if ( type == TypeType.STRING ) { if ( Dates.isISO8601QuickCheck ( buffer, startIndex, endIndex ) ) { if ( Dates.isJsonDate ( buffer, startIndex, endIndex ) ) { return Dates.fromJsonDate ( buffer, startIndex, endIndex ); } else if ( Dates.isISO8601Jackson(buffer, startIndex, endIndex) ) { return Dates.fromISO8601Jackson(buffer, startIndex, endIndex); } else if ( Dates.isISO8601 ( buffer, startIndex, endIndex ) ) { return Dates.fromISO8601 ( buffer, startIndex, endIndex ); } else { throw new IllegalStateException( "Unable to convert " + stringValue () + " to date " ); } } else { throw new IllegalStateException ( "Unable to convert " + stringValue () + " to date " ); } } else { return new Date ( Dates.utc ( longValue () ) ); } }
if ( Dates.isISO8601QuickCheck ( buffer, startIndex, endIndex ) ) { if (Dates.isJsonDate ( buffer,startIndex, endIndex )) { date = Dates.fromJsonDate ( buffer, startIndex, endIndex ); } else if (Dates.isISO8601( buffer, startIndex, endIndex )) { date = Dates.fromISO8601( buffer, startIndex, endIndex );
if ( Dates.isISO8601QuickCheck ( buffer, startIndex, endIndex ) ) { if (Dates.isJsonDate ( buffer,startIndex, endIndex )) { date = Dates.fromJsonDate ( buffer, startIndex, endIndex ); } else if (Dates.isISO8601( buffer, startIndex, endIndex )) { date = Dates.fromISO8601( buffer, startIndex, endIndex );