MCPcopy Create free account
hub / github.com/DiUS/java-faker / past

Method past

src/main/java/com/github/javafaker/DateAndTime.java:88–92  ·  view source on GitHub ↗

Generates a past date from now. Note that there is a 1 second slack added. @param atMost at most this amount of time earlier from now exclusive. @param unit the time unit. @return a past date from now.

(int atMost, TimeUnit unit)

Source from the content-addressed store, hash-verified

86 * @return a past date from now.
87 */
88 public Date past(int atMost, TimeUnit unit) {
89 Date now = new Date();
90 Date aBitEarlierThanNow = new Date(now.getTime() - 1000);
91 return past(atMost, unit, aBitEarlierThanNow);
92 }
93
94 /**
95 * Generates a past date from now, with a minimum time.

Callers 3

testPastDateMethod · 0.80

Calls 2

nextLongMethod · 0.80
randomMethod · 0.45

Tested by 3

testPastDateMethod · 0.64