Stores given date as long value. {@link Long#MIN_VALUE} is used if date is <code>null</code>.
517989
@NonNull
    public static SharedPreferences.Editor putDate(@NonNull SharedPreferences.Editor editor,
            @NonNull String key, @Nullable Date value) {
        editor.putLong(key, value == null ? Long.MIN_VALUE : value.getTime());
        return editor;
    }
1339078
public final void setValue(Object value) {
        if (value instanceof Date) {
            content = formatDateTime((Date)value);
        } else
            if (value != null) {
                content = value.toString();
            } else {
                content = null;
            }
    }
65244
public void setExpiredEnd(Date expiredEnd) throws InvalidArgumentException {
        if (expiredEnd == null) {
            throw new InvalidArgumentException("Date can't be null");
        }
        queryParms.put("expired_end", Util.dateToString(expiredEnd));
    }
1142817
public Date getDate(final long min, final long max) {
		long millis = getLong(min, max);
		return DateUtils.truncate(new Date(millis), Calendar.DATE);
	}
742754
public Date toDate(Object date) {

        Date d = null;
        if (null != date) {
            if (date instanceof Date) {
                d = (Date)date;
            } else if (date instanceof Long) {
                d = new Date(((Long)date).longValue());
            } else {
                try {
                    long l = Long.parseLong(date.toString());
                    d = new Date(l);
                } catch (Exception e) {
                    // do nothing, just let d remain null
                }
            }
        }
        return d;
    }
994266
public static String getDateAsIso8601(long date) {

        // Check if date is set
        if ((date > Long.MIN_VALUE) && (date < Long.MAX_VALUE)) {
            final Date d_date = new Date(date);
            return getDateAsIso8601(d_date);
        }
        return null;
    }
946059
public static long getLong(JsonObject object, String field, long defaultValue) {
        final JsonValue value = object.get(field);
        if (value == null || value.isNull()) {
            return defaultValue;
        } else {
            return value.asLong();
        }
    }
718651
@NotNull
    public static OptionalLong ofNullable(@Nullable Long value) {
        return value == null ? EMPTY : new OptionalLong(value);
    }
1124038
synchronized public void reset(long value) {

        if (value < minValue || value > maxValue) {
            throw Error.error(ErrorCode.X_42597);
        }

        startValue = currValue = lastValue = value;
    }
1160033
public JBBPOut Long(final long... value) throws IOException {
    assertNotEnded();
    assertArrayNotNull(value);
    if (this.processCommands) {
      for (final long l : value) {
        _writeLong(l);
      }
    }
    return this;
  }
1259381
public LongConstant getLongByValue(long value)
  {
    for (int i = 0; i < _entries.size(); i++) {
      ConstantPoolEntry entry = _entries.get(i);

      if (! (entry instanceof LongConstant))
        continue;

      LongConstant longEntry = (LongConstant) entry;

      if (longEntry.getValue() == value)
        return longEntry;
    }

    return null;
  }
1045689
public Date dateValue(String date) {
		Date value = null;
		if (date != null) {

			// Try each simple date formatter in order
			ParseException exception = null;
			for (SimpleDateFormat sdf : formatters) {
				try {
					synchronized (sdf) {
						value = sdf.parse(date);
					}
					break;
				} catch (ParseException e) {
					if (exception == null) {
						exception = e;
					}
				}
			}

			// If no value could be parsed throw the first expected parse
			// format exception
			if (value == null) {
				throw new GeoPackageException("Failed to parse date string: "
						+ date, exception);
			}

		}
		return value;
	}
831873
public static long updateLong(long value, long range)
     {
         range = range == 0 ? (long)(0.1 * value) : range;
         long minValue = value - range;
         long maxValue = value + range;
         return nextLong(minValue, maxValue);
     }
324335
@Nullable
    public static Date getDate(@NonNull SharedPreferences prefs, @NonNull String key) {
        long time = prefs.getLong(key, Long.MIN_VALUE);
        return time == Long.MIN_VALUE ? null : new Date(time);
    }
1248339
public static String formatDate(long value) {
        synchronized (HttpDateFormat.class) {
            Date dateValue = new Date(value);
            return FORMAT.format(dateValue);
        }
    }
214395
public void writeLong(long value)
        throws IOException
    {
        int offset = _offset;
        byte[] buffer = _buffer;

        if (SIZE <= offset + 16) {
            flushBuffer();
            offset = _offset;
        }

        if (LONG_DIRECT_MIN <= value && value <= LONG_DIRECT_MAX) {
            buffer[offset++] = (byte) (value + BC_LONG_ZERO);
        }
        else if (LONG_BYTE_MIN <= value && value <= LONG_BYTE_MAX) {
            buffer[offset++] = (byte) (BC_LONG_BYTE_ZERO + (value >> 8));
            buffer[offset++] = (byte) (value);
        }
        else if (LONG_SHORT_MIN <= value && value <= LONG_SHORT_MAX) {
            buffer[offset++] = (byte) (BC_LONG_SHORT_ZERO + (value >> 16));
            buffer[offset++] = (byte) (value >> 8);
            buffer[offset++] = (byte) (value);
        }
        else if (-0x80000000L <= value && value <= 0x7fffffffL) {
            buffer[offset + 0] = (byte) BC_LONG_INT;
            buffer[offset + 1] = (byte) (value >> 24);
            buffer[offset + 2] = (byte) (value >> 16);
            buffer[offset + 3] = (byte) (value >> 8);
            buffer[offset + 4] = (byte) (value);

            offset += 5;
        }
        else {
            buffer[offset + 0] = (byte) 'L';
            buffer[offset + 1] = (byte) (value >> 56);
            buffer[offset + 2] = (byte) (value >> 48);
            buffer[offset + 3] = (byte) (value >> 40);
            buffer[offset + 4] = (byte) (value >> 32);
            buffer[offset + 5] = (byte) (value >> 24);
            buffer[offset + 6] = (byte) (value >> 16);
            buffer[offset + 7] = (byte) (value >> 8);
            buffer[offset + 8] = (byte) (value);

            offset += 9;
        }

        _offset = offset;
    }
1076866
public Datapoint addLongValue(long time, long value) {
        initialValues();
        checkType(TsdbConstants.TYPE_LONG);

        values.add(Lists.<JsonNode> newArrayList(new LongNode(time), new LongNode(value)));
        return this;
    }