Module preprocessor.custom_date_provider

Functions

def format_date(x: datetime.datetime)

Classes

class CustomDateTimeProvider (generator: Any)

Base class for fake data providers :param generator: Generator instance

Ancestors

  • faker.providers.BaseProvider

Class variables

var end_date_default
var start_date_default
var tz
var zero_offset_indicator

Methods

def tripleblind_date(self, pattern: str = '%Y-%m-%d', start_date: str = '1970-01-01T00:00:00Z', end_date: str = '2024-05-29T13:38:19Z') -> str

Get a date string between January 1, 1970 and now unless given a start date and/or end date :param pattern: Format of the date (year-month-day by default) – accepts strftime formats :param start_date: iso date string :param end_date: iso date string :example: '2008-11-27' :return: str

def tripleblind_date_time(self, tz: Optional[datetime.tzinfo] = datetime.timezone.utc, start_date: datetime.datetime = None, end_date: datetime.datetime = None) -> datetime.datetime

Get a datetime timestamp for a date between January 1, 1970 and now, unless given a start and/or end date :param tz: timezone, instance of datetime.tzinfo subclass :param start_date: datetime(1970, 1,1) :param end_date: datetime(1970, 1,1) :example: datetime('2005-08-16 20:39:21') :return: datetime

def tripleblind_iso8601(self, start_date: str = '1970-01-01T00:00:00Z', end_date: str = '2024-05-29T13:38:19Z', sep: str = 'T', timespec: str = 'auto') -> str

Get a timestamp in ISO 8601 format (or one of its profiles). :param start_date: iso date string :param end_date: iso date string :param sep: separator between date and time, defaults to 'T' :param timespec: format specifier for the time part, defaults to 'auto' - see datetime.isoformat() documentation :example: '2003-10-21T16:05:52+0000'

def tripleblind_unix_time(self, start_date: str = '1970-01-01T00:00:00Z', end_date: str = '2024-05-29T13:38:19Z') -> int

:param start_date: iso date string :param end_date: iso date string Get a timestamp between January 1, 1970 and now, unless passed explicit start_datetime or end_datetime values. :example: 1061306726