Skip to content

Generators

instant

Dates and times as Timestamp, with no Foundation dependency.

var faker = Faker(seed: 1337, locale: DecoyLocaleEN.locale)
faker.instant.past()
Method Example output
past(years: Double = 1) 2025-11-30T15:31:55Z
2025-01-14T06:45:06Z
2025-01-16T03:40:22Z
future(years: Double = 1) 2026-04-08T02:42:44Z
2026-03-02T12:12:22Z
2026-01-22T10:20:59Z
recent(days: Int = 1) 2025-12-31T14:56:35Z
2025-12-31T10:00:11Z
2025-12-31T20:57:22Z
soon(days: Int = 1) 2026-01-01T02:07:23Z
2026-01-01T13:58:08Z
2026-01-01T01:38:33Z
between(_ start: Timestamp, _ end: Timestamp) needs arguments
birthdate(minAge: Int = 18, maxAge: Int = 80) 1955-05-05T09:47:22Z
1952-03-28T04:16:40Z
1972-02-10T02:41:09Z
monthName(abbreviated: Bool = false) March
September
February
weekdayName(abbreviated: Bool = false) Tuesday
Thursday
Monday
timeZone() Asia/Anadyr
America/Santarem
America/Chicago
year(in range: ClosedRange<Int>? = nil) 1931
1930
1929
month() 3
9
6
dayOfMonth() 20
13
15
dayOfWeek() 5
6
1
hour() 19
7
8
minute() 9
28
52
amPm() PM
AM
unix(years: Double = 30) 1827170102
2043251414
1209413941
century() IV
VIII
I

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.