Skip to content

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 +0000
2025-08-27 00:56:41 +0000
2025-11-27 03:22:28 +0000
future(years: Double = 1) 2026-10-09 12:08:10 +0000
2026-02-13 00:57:11 +0000
2026-07-19 19:39:27 +0000
recent(days: Int = 1) 2025-12-31 02:42:08 +0000
2025-12-31 05:34:29 +0000
2025-12-31 21:10:28 +0000
soon(days: Int = 1) 2026-01-01 17:50:28 +0000
2026-01-01 10:45:21 +0000
2026-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 +0000
1972-10-01 21:24:23 +0000
1996-12-03 09:53:27 +0000
monthName(abbreviated: Bool = false) September
November
June
weekdayName(abbreviated: Bool = false) Wednesday
Friday
Thursday
timeZone() Asia/Manila
Asia/Riyadh
Europe/Simferopol
year(in range: ClosedRange<Int>? = nil) 1955
1988
1964
month() 5
7
9
dayOfMonth() 26
7
2
dayOfWeek() 3
2
5
hour() 5
23
3
minute() 52
41
56
amPm() PM
AM
unix(years: Double = 30) 1164549670
1358519491
877448296
century() VI
XVII
XII

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.