Generator to generate time and date.
Representation of a specific day, month, and year, often used for chronological reference.
Format
a random date
import { Faker } from "k6/x/faker"let faker = new Faker(11)export default function () { console.log(faker.time.date("RFC3339"))} Copy
import { Faker } from "k6/x/faker"let faker = new Faker(11)export default function () { console.log(faker.time.date("RFC3339"))}
Output (formatted as JSON value)
"2011-10-23T18:10:11Z" Copy
"2011-10-23T18:10:11Z"
Random date between two ranges.
Start Date
End Date
a random daterange
import { Faker } from "k6/x/faker"let faker = new Faker(11)export default function () { console.log(faker.time.dateRange("1970-01-01","2024-09-05","yyyy-MM-dd"))} Copy
import { Faker } from "k6/x/faker"let faker = new Faker(11)export default function () { console.log(faker.time.dateRange("1970-01-01","2024-09-05","yyyy-MM-dd"))}
"1988-03-03" Copy
"1988-03-03"
24-hour period equivalent to one rotation of Earth on its axis.
a random day
import { Faker } from "k6/x/faker"let faker = new Faker(11)export default function () { console.log(faker.time.day())} Copy
import { Faker } from "k6/x/faker"let faker = new Faker(11)export default function () { console.log(faker.time.day())}
22 Copy
22
Date that has occurred after the current moment in time.
a random futuretime
import { Faker } from "k6/x/faker"let faker = new Faker(11)export default function () { console.log(faker.time.futureTime())} Copy
import { Faker } from "k6/x/faker"let faker = new Faker(11)export default function () { console.log(faker.time.futureTime())}
"2024-09-05T22:35:15.223243185+02:00" Copy
"2024-09-05T22:35:15.223243185+02:00"
Unit of time equal to 60 minutes.
a random hour
import { Faker } from "k6/x/faker"let faker = new Faker(11)export default function () { console.log(faker.time.hour())} Copy
import { Faker } from "k6/x/faker"let faker = new Faker(11)export default function () { console.log(faker.time.hour())}
21 Copy
21
Unit of time equal to 60 seconds.
a random minute
import { Faker } from "k6/x/faker"let faker = new Faker(11)export default function () { console.log(faker.time.minute())} Copy
import { Faker } from "k6/x/faker"let faker = new Faker(11)export default function () { console.log(faker.time.minute())}
9 Copy
9
Division of the year, typically 30 or 31 days long.
a random month
import { Faker } from "k6/x/faker"let faker = new Faker(11)export default function () { console.log(faker.time.month())} Copy
import { Faker } from "k6/x/faker"let faker = new Faker(11)export default function () { console.log(faker.time.month())}
10 Copy
10
String Representation of a month name.
a random month string
import { Faker } from "k6/x/faker"let faker = new Faker(11)export default function () { console.log(faker.time.monthString())} Copy
import { Faker } from "k6/x/faker"let faker = new Faker(11)export default function () { console.log(faker.time.monthString())}
"October" Copy
"October"
Unit of time equal to One billionth (10^-9) of a second.
a random nanosecond
import { Faker } from "k6/x/faker"let faker = new Faker(11)export default function () { console.log(faker.time.nanosecond())} Copy
import { Faker } from "k6/x/faker"let faker = new Faker(11)export default function () { console.log(faker.time.nanosecond())}
953698829 Copy
953698829
Date that has occurred before the current moment in time.
a random pasttime
import { Faker } from "k6/x/faker"let faker = new Faker(11)export default function () { console.log(faker.time.pastTime())} Copy
import { Faker } from "k6/x/faker"let faker = new Faker(11)export default function () { console.log(faker.time.pastTime())}
"2024-09-05T02:35:15.223523755+02:00" Copy
"2024-09-05T02:35:15.223523755+02:00"
Unit of time equal to 1/60th of a minute.
a random second
import { Faker } from "k6/x/faker"let faker = new Faker(11)export default function () { console.log(faker.time.second())} Copy
import { Faker } from "k6/x/faker"let faker = new Faker(11)export default function () { console.log(faker.time.second())}
Region where the same standard time is used, based on longitudinal divisions of the Earth.
a random timezone
import { Faker } from "k6/x/faker"let faker = new Faker(11)export default function () { console.log(faker.time.timezone())} Copy
import { Faker } from "k6/x/faker"let faker = new Faker(11)export default function () { console.log(faker.time.timezone())}
"Tonga Standard Time" Copy
"Tonga Standard Time"
Abbreviated 3-letter word of a timezone.
a random timezone abbreviation
import { Faker } from "k6/x/faker"let faker = new Faker(11)export default function () { console.log(faker.time.timezoneAbbreviation())} Copy
import { Faker } from "k6/x/faker"let faker = new Faker(11)export default function () { console.log(faker.time.timezoneAbbreviation())}
"TST" Copy
"TST"
Full name of a timezone.
a random timezone full
import { Faker } from "k6/x/faker"let faker = new Faker(11)export default function () { console.log(faker.time.timezoneFull())} Copy
import { Faker } from "k6/x/faker"let faker = new Faker(11)export default function () { console.log(faker.time.timezoneFull())}
"(UTC+13:00) Nuku'alofa" Copy
"(UTC+13:00) Nuku'alofa"
The difference in hours from Coordinated Universal Time (UTC) for a specific region.
a random timezone offset
import { Faker } from "k6/x/faker"let faker = new Faker(11)export default function () { console.log(faker.time.timezoneOffset())} Copy
import { Faker } from "k6/x/faker"let faker = new Faker(11)export default function () { console.log(faker.time.timezoneOffset())}
13 Copy
13
Geographic area sharing the same standard time.
a random timezone region
import { Faker } from "k6/x/faker"let faker = new Faker(11)export default function () { console.log(faker.time.timezoneRegion())} Copy
import { Faker } from "k6/x/faker"let faker = new Faker(11)export default function () { console.log(faker.time.timezoneRegion())}
"Asia/Manila" Copy
"Asia/Manila"
Day of the week excluding the weekend.
a random weekday
import { Faker } from "k6/x/faker"let faker = new Faker(11)export default function () { console.log(faker.time.weekday())} Copy
import { Faker } from "k6/x/faker"let faker = new Faker(11)export default function () { console.log(faker.time.weekday())}
"Sunday" Copy
"Sunday"
Period of 365 days, the time Earth takes to orbit the Sun.
a random year
import { Faker } from "k6/x/faker"let faker = new Faker(11)export default function () { console.log(faker.time.year())} Copy
import { Faker } from "k6/x/faker"let faker = new Faker(11)export default function () { console.log(faker.time.year())}
1979 Copy
1979
Generator to generate time and date.