Locale ar_EG¶
faker.providers.date_time
¶
- class faker.providers.date_time.ar_EG.Provider(generator: Any)¶
Bases:
Provider
- am_pm() str ¶
- Examples:
>>> Faker.seed(0) >>> for _ in range(5): ... fake.am_pm() ... 'م' 'م' 'ص' 'ص' 'م'
- century() str ¶
- Example:
‘XVII’
- Examples:
>>> Faker.seed(0) >>> for _ in range(5): ... fake.century() ... 'الثالث عشر' 'الرابع عشر' 'الثاني' 'التاسع' 'الثامن عشر'
- date(pattern: str = '%Y-%m-%d', end_datetime: date | datetime | timedelta | str | int | None = None) str ¶
Get a date string between January 1, 1970 and now.
- Parameters:
pattern – Format of the date (year-month-day by default)
- Example:
‘2008-11-27’
- Returns:
Date
- Examples:
>>> Faker.seed(0) >>> for _ in range(5): ... fake.date() ... '2016-03-25' '2011-07-01' '1993-01-10' '1984-03-05' '1997-12-28'
- date_between(start_date: date | datetime | timedelta | str | int = '-30y', end_date: date | datetime | timedelta | str | int = 'today') date ¶
Get a Date object based on a random date between two given dates. Accepts date strings that can be recognized by strtotime().
- Parameters:
start_date – Defaults to 30 years ago
end_date – Defaults to “today”
- Example:
Date(‘1999-02-02’)
- Returns:
Date
- Examples:
>>> Faker.seed(0) >>> for _ in range(5): ... fake.date_between() ... datetime.date(2020, 1, 30) datetime.date(2017, 6, 26) datetime.date(2007, 5, 13) datetime.date(2002, 7, 7) datetime.date(2010, 1, 31)
- date_between_dates(date_start: date | datetime | timedelta | str | int | None = None, date_end: date | datetime | timedelta | str | int | None = None) date ¶
Takes two Date objects and returns a random date between the two given dates. Accepts Date or datetime objects
- Parameters:
date_start – Date
date_end – Date
- Returns:
Date
- Examples:
>>> Faker.seed(0) >>> for _ in range(5): ... fake.date_between_dates() ... datetime.date(2024, 9, 30) datetime.date(2024, 9, 30) datetime.date(2024, 9, 30) datetime.date(2024, 9, 30) datetime.date(2024, 9, 30)
- date_object(end_datetime: datetime | None = None) date ¶
Get a date object between January 1, 1970 and now
- Example:
datetime.date(2016, 9, 20)
- Examples:
>>> Faker.seed(0) >>> for _ in range(5): ... fake.date_object() ... datetime.date(2016, 3, 25) datetime.date(2011, 7, 1) datetime.date(1993, 1, 10) datetime.date(1984, 3, 5) datetime.date(1997, 12, 28)
- date_of_birth(tzinfo: tzinfo | None = None, minimum_age: int = 0, maximum_age: int = 115) date ¶
Generate a random date of birth represented as a Date object, constrained by optional miminimum_age and maximum_age parameters.
- Parameters:
tzinfo – Defaults to None.
minimum_age – Defaults to 0.
maximum_age – Defaults to 115.
- Example:
Date(‘1979-02-02’)
- Returns:
Date
- Examples:
>>> Faker.seed(0) >>> for _ in range(5): ... fake.date_of_birth() ... datetime.date(2006, 9, 13) datetime.date(1996, 9, 1) datetime.date(1957, 7, 14) datetime.date(1938, 10, 13) datetime.date(1968, 1, 21)
- date_this_century(before_today: bool = True, after_today: bool = False) date ¶
Gets a Date object for the current century.
- Parameters:
before_today – include days in current century before today
after_today – include days in current century after today
- Example:
Date(‘2012-04-04’)
- Returns:
Date
- Examples:
>>> Faker.seed(0) >>> for _ in range(5): ... fake.date_this_century() ... datetime.date(2020, 11, 23) datetime.date(2018, 10, 4) datetime.date(2010, 5, 29) datetime.date(2006, 5, 29) datetime.date(2012, 8, 26)
- date_this_decade(before_today: bool = True, after_today: bool = False) date ¶
Gets a Date object for the decade year.
- Parameters:
before_today – include days in current decade before today
after_today – include days in current decade after today
- Example:
Date(‘2012-04-04’)
- Returns:
Date
- Examples:
>>> Faker.seed(0) >>> for _ in range(5): ... fake.date_this_decade() ... datetime.date(2024, 1, 4) datetime.date(2023, 8, 7) datetime.date(2021, 12, 30) datetime.date(2021, 3, 24) datetime.date(2022, 6, 5)
- date_this_month(before_today: bool = True, after_today: bool = False) date ¶
Gets a Date object for the current month.
- Parameters:
before_today – include days in current month before today
after_today – include days in current month after today
- Example:
dtdate(‘2012-04-04’)
- Returns:
dtdate
- Examples:
>>> Faker.seed(0) >>> for _ in range(5): ... fake.date_this_month() ... datetime.date(2024, 9, 25) datetime.date(2024, 9, 22) datetime.date(2024, 9, 13) datetime.date(2024, 9, 8) datetime.date(2024, 9, 15)
- date_this_year(before_today: bool = True, after_today: bool = False) date ¶
Gets a Date object for the current year.
- Parameters:
before_today – include days in current year before today
after_today – include days in current year after today
- Example:
Date(‘2012-04-04’)
- Returns:
Date
- Examples:
>>> Faker.seed(0) >>> for _ in range(5): ... fake.date_this_year() ... datetime.date(2024, 8, 18) datetime.date(2024, 7, 25) datetime.date(2024, 4, 24) datetime.date(2024, 3, 11) datetime.date(2024, 5, 19)
- date_time(tzinfo: tzinfo | None = None, end_datetime: date | datetime | timedelta | str | int | None = None) datetime ¶
Get a datetime object for a date between January 1, 1970 and now
- Parameters:
tzinfo – timezone, instance of datetime.tzinfo subclass
- Example:
datetime(‘2005-08-16 20:39:21’)
- Returns:
datetime
- Examples:
>>> Faker.seed(0) >>> for _ in range(5): ... fake.date_time() ... datetime.datetime(2016, 3, 25, 15, 6, 22, 369996) datetime.datetime(2011, 7, 1, 13, 37, 50, 719510) datetime.datetime(1993, 1, 10, 0, 47, 54, 77675) datetime.datetime(1984, 3, 5, 11, 22, 45, 491384) datetime.datetime(1997, 12, 28, 19, 4, 4, 635748)
- date_time_ad(tzinfo: tzinfo | None = None, end_datetime: date | datetime | timedelta | str | int | None = None, start_datetime: date | datetime | timedelta | str | int | None = None) datetime ¶
Get a datetime object for a date between January 1, 001 and now
- Parameters:
tzinfo – timezone, instance of datetime.tzinfo subclass
- Example:
datetime(‘1265-03-22 21:15:52’)
- Returns:
datetime
- Examples:
>>> Faker.seed(0) >>> for _ in range(5): ... fake.date_time_ad() ... datetime.datetime(1709, 11, 24, 17, 41, 17, 839851) datetime.datetime(1534, 11, 29, 13, 44, 4, 602882) datetime.datetime(852, 2, 18, 3, 10, 46, 121674) datetime.datetime(524, 12, 25, 13, 29, 26, 461235) datetime.datetime(1035, 9, 11, 3, 29, 45, 627953)
- date_time_between(start_date: date | datetime | timedelta | str | int = '-30y', end_date: date | datetime | timedelta | str | int = 'now', tzinfo: tzinfo | None = None) datetime ¶
Get a datetime object based on a random date between two given dates. Accepts date strings that can be recognized by strtotime().
- Parameters:
start_date – Defaults to 30 years ago
end_date – Defaults to “now”
tzinfo – timezone, instance of datetime.tzinfo subclass
- Example:
datetime(‘1999-02-02 11:42:52’)
- Returns:
datetime
- Examples:
>>> Faker.seed(0) >>> for _ in range(5): ... fake.date_time_between() ... datetime.datetime(2020, 1, 30, 23, 22, 53, 236214) datetime.datetime(2017, 6, 27, 12, 47, 39, 808743) datetime.datetime(2007, 5, 14, 18, 17, 20, 361449) datetime.datetime(2002, 7, 8, 11, 27, 56, 49189) datetime.datetime(2010, 2, 1, 14, 44, 52, 171082)
- date_time_between_dates(datetime_start: date | datetime | timedelta | str | int | None = None, datetime_end: date | datetime | timedelta | str | int | None = None, tzinfo: tzinfo | None = None) datetime ¶
Takes two datetime objects and returns a random datetime between the two given datetimes. Accepts datetime objects.
- Parameters:
datetime_start – datetime
datetime_end – datetime
tzinfo – timezone, instance of datetime.tzinfo subclass
- Example:
datetime(‘1999-02-02 11:42:52’)
- Returns:
datetime
- Examples:
>>> Faker.seed(0) >>> for _ in range(5): ... fake.date_time_between_dates() ... datetime.datetime(2024, 9, 30, 16, 12, 10) datetime.datetime(2024, 9, 30, 16, 12, 10) datetime.datetime(2024, 9, 30, 16, 12, 10) datetime.datetime(2024, 9, 30, 16, 12, 10) datetime.datetime(2024, 9, 30, 16, 12, 10)
- date_time_this_century(before_now: bool = True, after_now: bool = False, tzinfo: tzinfo | None = None) datetime ¶
Gets a datetime object for the current century.
- Parameters:
before_now – include days in current century before today
after_now – include days in current century after today
tzinfo – timezone, instance of datetime.tzinfo subclass
- Example:
datetime(‘2012-04-04 11:02:02’)
- Returns:
datetime
- Examples:
>>> Faker.seed(0) >>> for _ in range(5): ... fake.date_time_this_century() ... datetime.datetime(2020, 11, 24, 7, 10, 50, 743376) datetime.datetime(2018, 10, 4, 15, 52, 38, 362850) datetime.datetime(2010, 5, 29, 19, 55, 51, 193142) datetime.datetime(2006, 5, 29, 12, 33, 33, 523640) datetime.datetime(2012, 8, 26, 18, 10, 37, 291851)
- date_time_this_decade(before_now: bool = True, after_now: bool = False, tzinfo: tzinfo | None = None) datetime ¶
Gets a datetime object for the decade year.
- Parameters:
before_now – include days in current decade before today
after_now – include days in current decade after today
tzinfo – timezone, instance of datetime.tzinfo subclass
- Example:
datetime(‘2012-04-04 11:02:02’)
- Returns:
datetime
- Examples:
>>> Faker.seed(0) >>> for _ in range(5): ... fake.date_time_this_decade() ... datetime.datetime(2024, 1, 4, 19, 8, 30, 309639) datetime.datetime(2023, 8, 7, 19, 18, 41, 38273) datetime.datetime(2021, 12, 30, 13, 19, 16, 808593) datetime.datetime(2021, 3, 25, 3, 16, 28, 742736) datetime.datetime(2022, 6, 5, 21, 29, 34, 350611)
- date_time_this_month(before_now: bool = True, after_now: bool = False, tzinfo: tzinfo | None = None) datetime ¶
Gets a datetime object for the current month.
- Parameters:
before_now – include days in current month before today
after_now – include days in current month after today
tzinfo – timezone, instance of datetime.tzinfo subclass
- Example:
datetime(‘2012-04-04 11:02:02’)
- Returns:
datetime
- Examples:
>>> Faker.seed(0) >>> for _ in range(5): ... fake.date_time_this_month() ... datetime.datetime(2024, 9, 26, 1, 23, 58, 517781) datetime.datetime(2024, 9, 23, 11, 49, 2, 32331) datetime.datetime(2024, 9, 13, 11, 31, 56, 93240) datetime.datetime(2024, 9, 8, 16, 24, 4, 423579) datetime.datetime(2024, 9, 16, 4, 7, 52, 596359)
- date_time_this_year(before_now: bool = True, after_now: bool = False, tzinfo: tzinfo | None = None) datetime ¶
Gets a datetime object for the current year.
- Parameters:
before_now – include days in current year before today
after_now – include days in current year after today
tzinfo – timezone, instance of datetime.tzinfo subclass
- Example:
datetime(‘2012-04-04 11:02:02’)
- Returns:
datetime
- Examples:
>>> Faker.seed(0) >>> for _ in range(5): ... fake.date_time_this_year() ... datetime.datetime(2024, 8, 19, 2, 20, 2, 222891) datetime.datetime(2024, 7, 26, 10, 23, 53, 573357) datetime.datetime(2024, 4, 25, 2, 23, 57, 931683) datetime.datetime(2024, 3, 11, 20, 37, 3, 786555) datetime.datetime(2024, 5, 19, 22, 9, 21, 762363)
- day_of_month() str ¶
- Examples:
>>> Faker.seed(0) >>> for _ in range(5): ... fake.day_of_month() ... '25' '01' '10' '05' '28'
- day_of_week() str ¶
- Examples:
>>> Faker.seed(0) >>> for _ in range(5): ... fake.day_of_week() ... 'الخميس' 'الخميس' 'السبت' 'الأحد' 'السبت'
- future_date(end_date: date | datetime | timedelta | str | int = '+30d', tzinfo: tzinfo | None = None) date ¶
Get a Date object based on a random date between 1 day from now and a given date. Accepts date strings that can be recognized by strtotime().
- Parameters:
end_date – Defaults to “+30d”
tzinfo – timezone, instance of datetime.tzinfo subclass
- Example:
dtdate(‘2030-01-01’)
- Returns:
dtdate
- Examples:
>>> Faker.seed(0) >>> for _ in range(5): ... fake.future_date() ... datetime.date(2024, 10, 25) datetime.date(2024, 10, 22) datetime.date(2024, 10, 13) datetime.date(2024, 10, 8) datetime.date(2024, 10, 15)
- future_datetime(end_date: date | datetime | timedelta | str | int = '+30d', tzinfo: tzinfo | None = None) datetime ¶
Get a datetime object based on a random date between 1 second form now and a given date. Accepts date strings that can be recognized by strtotime().
- Parameters:
end_date – Defaults to “+30d”
tzinfo – timezone, instance of datetime.tzinfo subclass
- Example:
datetime(‘1999-02-02 11:42:52’)
- Returns:
datetime
- Examples:
>>> Faker.seed(0) >>> for _ in range(5): ... fake.future_datetime() ... datetime.datetime(2024, 10, 26, 0, 11, 11, 594731) datetime.datetime(2024, 10, 23, 9, 55, 48, 54467) datetime.datetime(2024, 10, 13, 7, 0, 52, 116942) datetime.datetime(2024, 10, 8, 10, 37, 22, 957843) datetime.datetime(2024, 10, 16, 0, 19, 14, 566513)
- iso8601(tzinfo: tzinfo | None = None, end_datetime: date | datetime | timedelta | str | int | None = None, sep: str = 'T', timespec: str = 'auto') str ¶
Get a timestamp in ISO 8601 format (or one of its profiles).
- Parameters:
tzinfo – timezone, instance of datetime.tzinfo subclass
sep – separator between date and time, defaults to ‘T’
timespec – format specifier for the time part, defaults to ‘auto’ - see datetime.isoformat() documentation
- Example:
‘2003-10-21T16:05:52+0000’
- Examples:
>>> Faker.seed(0) >>> for _ in range(5): ... fake.iso8601() ... '2016-03-25T15:06:22.369996' '2011-07-01T13:37:50.719510' '1993-01-10T00:47:54.077675' '1984-03-05T11:22:45.491384' '1997-12-28T19:04:04.635748'
- month() str ¶
- Examples:
>>> Faker.seed(0) >>> for _ in range(5): ... fake.month() ... '03' '07' '01' '03' '12'
- month_name() str ¶
- Examples:
>>> Faker.seed(0) >>> for _ in range(5): ... fake.month_name() ... 'مارس' 'يوليو' 'يناير' 'مارس' 'ديسمبر'
- past_date(start_date: date | datetime | timedelta | str | int = '-30d', tzinfo: tzinfo | None = None) date ¶
Get a Date object based on a random date between a given date and 1 day ago. Accepts date strings that can be recognized by strtotime().
- Parameters:
start_date – Defaults to “-30d”
tzinfo – timezone, instance of datetime.tzinfo subclass
- Example:
dtdate(‘1999-02-02’)
- Returns:
dtdate
- Examples:
>>> Faker.seed(0) >>> for _ in range(5): ... fake.past_date() ... datetime.date(2024, 9, 24) datetime.date(2024, 9, 21) datetime.date(2024, 9, 12) datetime.date(2024, 9, 7) datetime.date(2024, 9, 14)
- past_datetime(start_date: date | datetime | timedelta | str | int = '-30d', tzinfo: tzinfo | None = None) datetime ¶
Get a datetime object based on a random date between a given date and 1 second ago. Accepts date strings that can be recognized by strtotime().
- Parameters:
start_date – Defaults to “-30d”
tzinfo – timezone, instance of datetime.tzinfo subclass
- Example:
datetime(‘1999-02-02 11:42:52’)
- Returns:
datetime
- Examples:
>>> Faker.seed(0) >>> for _ in range(5): ... fake.past_datetime() ... datetime.datetime(2024, 9, 26, 0, 11, 10, 594731) datetime.datetime(2024, 9, 23, 9, 55, 47, 54467) datetime.datetime(2024, 9, 13, 7, 0, 51, 116942) datetime.datetime(2024, 9, 8, 10, 37, 21, 957843) datetime.datetime(2024, 9, 16, 0, 19, 13, 566513)
- pytimezone(*args: Any, **kwargs: Any) tzinfo | None ¶
Generate a random timezone (see faker.timezone for any args) and return as a python object usable as a tzinfo to datetime or other fakers.
- Example:
faker.pytimezone()
- Returns:
dateutil.tz.tz.tzfile
- Examples:
>>> Faker.seed(0) >>> for _ in range(5): ... fake.pytimezone() ... None None None None None
- time(pattern: str = '%H:%M:%S', end_datetime: date | datetime | timedelta | str | int | None = None) str ¶
Get a time string (24h format by default)
- Parameters:
pattern – format
- Example:
‘15:02:34’
- Examples:
>>> Faker.seed(0) >>> for _ in range(5): ... fake.time() ... '15:06:22' '13:37:50' '00:47:54' '11:22:45' '19:04:04'
- time_delta(end_datetime: date | datetime | timedelta | str | int | None = None) timedelta ¶
Get a timedelta object
- Examples:
>>> Faker.seed(0) >>> for _ in range(5): ... fake.time_delta() ... datetime.timedelta(0) datetime.timedelta(0) datetime.timedelta(0) datetime.timedelta(0) datetime.timedelta(0)
- time_object(end_datetime: date | datetime | timedelta | str | int | None = None) time ¶
Get a time object
- Example:
datetime.time(15, 56, 56, 772876)
- Examples:
>>> Faker.seed(0) >>> for _ in range(5): ... fake.time_object() ... datetime.time(15, 6, 22, 369996) datetime.time(13, 37, 50, 719510) datetime.time(0, 47, 54, 77675) datetime.time(11, 22, 45, 491384) datetime.time(19, 4, 4, 635748)
- time_series(start_date: date | datetime | timedelta | str | int = '-30d', end_date: date | datetime | timedelta | str | int = 'now', precision: float | None = None, distrib: Callable[[datetime], float] | None = None, tzinfo: tzinfo | None = None) Iterator[Tuple[datetime, Any]] ¶
Returns a generator yielding tuples of
(<datetime>, <value>)
.The data points will start at
start_date
, and be at every time interval specified byprecision
.distrib
is a callable that accepts<datetime>
and returns<value>
- Examples:
>>> Faker.seed(0) >>> for _ in range(5): ... fake.time_series() ... <generator object Provider.time_series at 0x7f5fb7125230> <generator object Provider.time_series at 0x7f5fb7125230> <generator object Provider.time_series at 0x7f5fb7125230> <generator object Provider.time_series at 0x7f5fb7125230> <generator object Provider.time_series at 0x7f5fb7125230>
- timezone() str ¶
- Examples:
>>> Faker.seed(0) >>> for _ in range(5): ... fake.timezone() ... 'الهندي/جزر_المالديف' 'أمريكا/باربادوس' 'أوروبا/ستوكهولم' 'إفريقيا/ويندهوك' 'آسيا/قطر'
- unix_time(end_datetime: date | datetime | timedelta | str | int | None = None, start_datetime: date | datetime | timedelta | str | int | None = None) float ¶
Get a timestamp between January 1, 1970 and now, unless passed explicit start_datetime or end_datetime values.
On Windows, the decimal part is always 0.
- Example:
1061306726.6
- Examples:
>>> Faker.seed(0) >>> for _ in range(5): ... fake.unix_time() ... 1458918382.3699956 1309527470.71951 726626874.0776749 447333765.491384 883335844.6357479