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-12-19'
'2011-04-05'
'1992-11-22'
'1984-02-04'
'1997-10-31'
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, 10, 7)
datetime.date(2017, 3, 3)
datetime.date(2007, 1, 18)
datetime.date(2002, 3, 14)
datetime.date(2009, 10, 8)
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, 6, 7)
datetime.date(2024, 6, 7)
datetime.date(2024, 6, 7)
datetime.date(2024, 6, 7)
datetime.date(2024, 6, 7)
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, 12, 19)
datetime.date(2011, 4, 5)
datetime.date(1992, 11, 22)
datetime.date(1984, 2, 4)
datetime.date(1997, 10, 31)
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, 5, 21)
datetime.date(1996, 5, 9)
datetime.date(1957, 3, 21)
datetime.date(1938, 6, 20)
datetime.date(1967, 9, 28)
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, 8, 18)
datetime.date(2018, 7, 8)
datetime.date(2010, 4, 11)
datetime.date(2006, 4, 29)
datetime.date(2012, 6, 28)
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, 9, 29)
datetime.date(2023, 5, 12)
datetime.date(2021, 11, 11)
datetime.date(2021, 2, 23)
datetime.date(2022, 4, 7)
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, 6, 6)
datetime.date(2024, 6, 5)
datetime.date(2024, 6, 3)
datetime.date(2024, 6, 2)
datetime.date(2024, 6, 4)
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, 5, 13)
datetime.date(2024, 4, 29)
datetime.date(2024, 3, 7)
datetime.date(2024, 2, 10)
datetime.date(2024, 3, 21)
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, 12, 19, 13, 51, 53, 788622)
datetime.datetime(2011, 4, 5, 10, 54, 0, 244931)
datetime.datetime(1992, 11, 22, 16, 41, 58, 791996)
datetime.datetime(1984, 2, 4, 17, 11, 13, 225709)
datetime.datetime(1997, 10, 31, 0, 46, 30, 21635)
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, 8, 19, 16, 26, 49, 258476)
datetime.datetime(1534, 9, 3, 11, 0, 14, 128296)
datetime.datetime(851, 12, 31, 19, 4, 50, 835991)
datetime.datetime(524, 11, 25, 19, 17, 54, 195564)
datetime.datetime(1035, 7, 14, 9, 12, 11, 13840)
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, 10, 8, 0, 59, 44, 236214)
datetime.datetime(2017, 3, 4, 14, 24, 30, 808743)
datetime.datetime(2007, 1, 19, 19, 54, 11, 361449)
datetime.datetime(2002, 3, 15, 13, 4, 47, 49189)
datetime.datetime(2009, 10, 9, 16, 21, 43, 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, 6, 7, 17, 49, 1)
datetime.datetime(2024, 6, 7, 17, 49, 1)
datetime.datetime(2024, 6, 7, 17, 49, 1)
datetime.datetime(2024, 6, 7, 17, 49, 1)
datetime.datetime(2024, 6, 7, 17, 49, 1)
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, 8, 19, 5, 56, 22, 162002)
datetime.datetime(2018, 7, 9, 13, 8, 47, 888271)
datetime.datetime(2010, 4, 11, 11, 49, 55, 907464)
datetime.datetime(2006, 4, 29, 18, 22, 1, 257965)
datetime.datetime(2012, 6, 28, 23, 53, 2, 677738)
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, 9, 29, 17, 54, 1, 728265)
datetime.datetime(2023, 5, 12, 16, 34, 50, 563693)
datetime.datetime(2021, 11, 12, 5, 13, 21, 522914)
datetime.datetime(2021, 2, 23, 9, 4, 56, 477061)
datetime.datetime(2022, 4, 8, 3, 11, 59, 736498)
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, 6, 6, 16, 38, 30, 349809)
datetime.datetime(2024, 6, 6, 2, 38, 59, 515843)
datetime.datetime(2024, 6, 3, 20, 3, 20, 189269)
datetime.datetime(2024, 6, 2, 17, 53, 49, 622633)
datetime.datetime(2024, 6, 4, 10, 43, 58, 487461)
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, 5, 14, 1, 5, 33, 641517)
datetime.datetime(2024, 4, 30, 7, 40, 3, 98778)
datetime.datetime(2024, 3, 7, 18, 18, 2, 646004)
datetime.datetime(2024, 2, 11, 2, 25, 31, 520880)
datetime.datetime(2024, 3, 22, 3, 51, 47, 148250)
day_of_month() str
Examples:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.day_of_month()
...
'19'
'05'
'22'
'04'
'31'
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, 7, 2)
datetime.date(2024, 6, 29)
datetime.date(2024, 6, 20)
datetime.date(2024, 6, 15)
datetime.date(2024, 6, 22)
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, 7, 3, 1, 48, 2, 594731)
datetime.datetime(2024, 6, 30, 11, 32, 39, 54467)
datetime.datetime(2024, 6, 20, 8, 37, 43, 116942)
datetime.datetime(2024, 6, 15, 12, 14, 13, 957843)
datetime.datetime(2024, 6, 23, 1, 56, 5, 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-12-19T13:51:53.788622'
'2011-04-05T10:54:00.244931'
'1992-11-22T16:41:58.791996'
'1984-02-04T17:11:13.225709'
'1997-10-31T00:46:30.021635'
month() str
Examples:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.month()
...
'12'
'04'
'11'
'02'
'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, 6, 1)
datetime.date(2024, 5, 29)
datetime.date(2024, 5, 20)
datetime.date(2024, 5, 15)
datetime.date(2024, 5, 22)
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, 6, 3, 1, 48, 1, 594731)
datetime.datetime(2024, 5, 31, 11, 32, 38, 54467)
datetime.datetime(2024, 5, 21, 8, 37, 42, 116942)
datetime.datetime(2024, 5, 16, 12, 14, 12, 957843)
datetime.datetime(2024, 5, 24, 1, 56, 4, 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()
...
'13:51:53'
'10:54:00'
'16:41:58'
'17:11:13'
'00:46:30'
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(13, 51, 53, 788622)
datetime.time(10, 54, 0, 244931)
datetime.time(16, 41, 58, 791996)
datetime.time(17, 11, 13, 225709)
datetime.time(0, 46, 30, 21635)
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 0x7f39331ed4d0>
<generator object Provider.time_series at 0x7f39331ed4d0>
<generator object Provider.time_series at 0x7f39331ed4d0>
<generator object Provider.time_series at 0x7f39331ed4d0>
<generator object Provider.time_series at 0x7f39331ed4d0>
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()
...
1450533113.788622
1302000840.2449307
722450518.7919958
444762673.2257091
878258790.0216353
year() str
Examples:

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