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()
...
'2015-11-02'
'2011-02-21'
'1992-10-30'
'1984-01-21'
'1997-10-02'
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(2019, 8, 12)
datetime.date(2017, 1, 6)
datetime.date(2006, 11, 23)
datetime.date(2002, 1, 17)
datetime.date(2009, 8, 13)
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, 4, 12)
datetime.date(2024, 4, 12)
datetime.date(2024, 4, 12)
datetime.date(2024, 4, 12)
datetime.date(2024, 4, 12)
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(2015, 11, 2)
datetime.date(2011, 2, 21)
datetime.date(1992, 10, 30)
datetime.date(1984, 1, 21)
datetime.date(1997, 10, 2)
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, 3, 26)
datetime.date(1996, 3, 14)
datetime.date(1957, 1, 24)
datetime.date(1938, 4, 25)
datetime.date(1967, 8, 3)
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, 7, 2)
datetime.date(2018, 5, 27)
datetime.date(2010, 3, 18)
datetime.date(2006, 4, 15)
datetime.date(2012, 5, 30)
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(2023, 8, 12)
datetime.date(2023, 3, 30)
datetime.date(2021, 10, 19)
datetime.date(2021, 2, 8)
datetime.date(2022, 3, 10)
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, 4, 10)
datetime.date(2024, 4, 9)
datetime.date(2024, 4, 5)
datetime.date(2024, 4, 3)
datetime.date(2024, 4, 6)
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, 3, 27)
datetime.date(2024, 3, 18)
datetime.date(2024, 2, 12)
datetime.date(2024, 1, 27)
datetime.date(2024, 2, 22)
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(2015, 11, 2, 4, 36, 36, 928720)
datetime.datetime(2011, 2, 21, 22, 5, 54, 410900)
datetime.datetime(1992, 10, 30, 2, 16, 48, 604634)
datetime.datetime(1984, 1, 21, 4, 28, 54, 521753)
datetime.datetime(1997, 10, 2, 8, 11, 52, 369409)
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, 7, 3, 7, 11, 32, 398575)
datetime.datetime(1534, 7, 22, 22, 12, 8, 294266)
datetime.datetime(851, 12, 8, 4, 39, 40, 648628)
datetime.datetime(524, 11, 11, 6, 35, 35, 491608)
datetime.datetime(1035, 6, 15, 16, 37, 33, 361610)
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(2019, 8, 12, 22, 12, 38, 236214)
datetime.datetime(2017, 1, 7, 11, 37, 24, 808743)
datetime.datetime(2006, 11, 24, 17, 7, 5, 361449)
datetime.datetime(2002, 1, 18, 10, 17, 41, 49189)
datetime.datetime(2009, 8, 14, 13, 34, 37, 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, 4, 12, 15, 1, 55)
datetime.datetime(2024, 4, 12, 15, 1, 55)
datetime.datetime(2024, 4, 12, 15, 1, 55)
datetime.datetime(2024, 4, 12, 15, 1, 55)
datetime.datetime(2024, 4, 12, 15, 1, 55)
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, 7, 2, 20, 41, 5, 302100)
datetime.datetime(2018, 5, 28, 0, 20, 42, 54241)
datetime.datetime(2010, 3, 18, 21, 24, 45, 720102)
datetime.datetime(2006, 4, 15, 5, 39, 42, 554009)
datetime.datetime(2012, 5, 31, 7, 18, 25, 25512)
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(2023, 8, 13, 8, 38, 44, 868363)
datetime.datetime(2023, 3, 31, 3, 46, 44, 729663)
datetime.datetime(2021, 10, 19, 14, 48, 11, 335553)
datetime.datetime(2021, 2, 8, 20, 22, 37, 773105)
datetime.datetime(2022, 3, 10, 10, 37, 22, 84272)
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, 4, 10, 19, 37, 14, 416185)
datetime.datetime(2024, 4, 9, 19, 29, 36, 567070)
datetime.datetime(2024, 4, 5, 21, 21, 10, 461518)
datetime.datetime(2024, 4, 4, 0, 14, 45, 759421)
datetime.datetime(2024, 4, 6, 22, 39, 43, 126736)
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, 3, 27, 15, 50, 16, 781615)
datetime.datetime(2024, 3, 18, 18, 51, 57, 264747)
datetime.datetime(2024, 2, 13, 3, 52, 52, 458643)
datetime.datetime(2024, 1, 27, 13, 43, 12, 816924)
datetime.datetime(2024, 2, 22, 11, 17, 9, 496024)
day_of_month() str
Examples:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.day_of_month()
...
'02'
'21'
'30'
'21'
'02'
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, 5, 7)
datetime.date(2024, 5, 4)
datetime.date(2024, 4, 25)
datetime.date(2024, 4, 20)
datetime.date(2024, 4, 27)
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, 5, 7, 23, 0, 56, 594731)
datetime.datetime(2024, 5, 5, 8, 45, 33, 54467)
datetime.datetime(2024, 4, 25, 5, 50, 37, 116942)
datetime.datetime(2024, 4, 20, 9, 27, 7, 957843)
datetime.datetime(2024, 4, 27, 23, 8, 59, 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()
...
'2015-11-02T04:36:36.928720'
'2011-02-21T22:05:54.410900'
'1992-10-30T02:16:48.604634'
'1984-01-21T04:28:54.521753'
'1997-10-02T08:11:52.369409'
month() str
Examples:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.month()
...
'11'
'02'
'10'
'01'
'10'
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, 4, 6)
datetime.date(2024, 4, 3)
datetime.date(2024, 3, 25)
datetime.date(2024, 3, 20)
datetime.date(2024, 3, 27)
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, 4, 7, 23, 0, 55, 594731)
datetime.datetime(2024, 4, 5, 8, 45, 32, 54467)
datetime.datetime(2024, 3, 26, 5, 50, 36, 116942)
datetime.datetime(2024, 3, 21, 9, 27, 6, 957843)
datetime.datetime(2024, 3, 28, 23, 8, 58, 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()
...
'04:36:36'
'22:05:54'
'02:16:48'
'04:28:54'
'08:11:52'
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(4, 36, 36, 928720)
datetime.time(22, 5, 54, 410900)
datetime.time(2, 16, 48, 604634)
datetime.time(4, 28, 54, 521753)
datetime.time(8, 11, 52, 369409)
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 by precision. 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 0x7fd3014e62d0>
<generator object Provider.time_series at 0x7fd3014e62d0>
<generator object Provider.time_series at 0x7fd3014e62d0>
<generator object Provider.time_series at 0x7fd3014e62d0>
<generator object Provider.time_series at 0x7fd3014e62d0>
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()
...
1446438996.9287198
1298325954.4109004
720411408.6046344
443507334.5217532
875779912.369409
year() str
Examples:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.year()
...
'2015'
'2011'
'1992'
'1984'
'1997'