Generators
date
The same values as Foundation.Date. Only where Foundation exists.
var faker = Faker(seed: 1337, locale: DecoyLocaleEN.locale)faker.date.past()| Method | Example output |
|---|---|
past(years: Double = 1) |
2025-07-29 10:07:16 +00002025-08-27 00:56:41 +00002025-11-27 03:22:28 +0000 |
future(years: Double = 1) |
2026-10-09 12:08:10 +00002026-02-13 00:57:11 +00002026-07-19 19:39:27 +0000 |
recent(days: Int = 1) |
2025-12-31 02:42:08 +00002025-12-31 05:34:29 +00002025-12-31 21:10:28 +0000 |
soon(days: Int = 1) |
2026-01-01 17:50:28 +00002026-01-01 10:45:21 +00002026-01-01 12:42:22 +0000 |
between(_ start: Date, _ end: Date) |
needs arguments |
birthdate(minAge: Int = 18, maxAge: Int = 80) |
1960-07-27 01:33:31 +00001972-10-01 21:24:23 +00001996-12-03 09:53:27 +0000 |
monthName(abbreviated: Bool = false) |
SeptemberNovemberJune |
weekdayName(abbreviated: Bool = false) |
WednesdayFridayThursday |
timeZone() |
Asia/ManilaAsia/RiyadhEurope/Simferopol |
year(in range: ClosedRange<Int>? = nil) |
195519881964 |
month() |
579 |
dayOfMonth() |
2672 |
dayOfWeek() |
325 |
hour() |
5233 |
minute() |
524156 |
amPm() |
PMAM |
unix(years: Double = 30) |
11645496701358519491877448296 |
century() |
VIXVIIXII |
Examples are real output from three different seeds, captured when this page was built, using each method’s default arguments. Where a signature shows parameters, pass your own to change the size, gender, length or format.