CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-mimesis

Mimesis is a robust fake data generator for Python that produces realistic fake data across 35 different locales with high performance and multilingual support.

Pending
Overview
Eval results
Files

datetime.mddocs/

Date and Time Generation

Generate dates, times, timestamps, and time-related data with flexible date ranges, formatting options, and timezone support for testing temporal functionality.

Capabilities

Date Generation

class Datetime(BaseDataProvider):
    def date(self, start: int = 2000, end: int = 2023) -> datetime.date:
        """Generate a random date within specified year range."""
    
    def formatted_date(self, fmt: str = "", **kwargs) -> str:
        """Generate formatted date string with custom format."""
    
    def day_of_week(self, abbr: bool = False) -> str:
        """Generate day of week name or abbreviation."""
    
    def day_of_month(self) -> int:
        """Generate day of month (1-31)."""
    
    def month(self, abbr: bool = False) -> str:
        """Generate month name or abbreviation."""
    
    def year(self, minimum: int = 1990, maximum: int = 2023) -> int:
        """Generate year within specified range."""
    
    def century(self) -> str:
        """Generate century designation."""

Time Generation

class Datetime(BaseDataProvider):
    def time(self) -> datetime.time:
        """Generate random time."""
    
    def formatted_time(self, fmt: str = "") -> str:
        """Generate formatted time string."""
    
    def datetime(self, start: int = 2000, end: int = 2023) -> datetime.datetime:
        """Generate random datetime within year range."""
    
    def formatted_datetime(self, fmt: str = "", **kwargs) -> str:
        """Generate formatted datetime string."""

Timezone and Temporal Data

class Datetime(BaseDataProvider):
    def timezone(self, region: TimezoneRegion = None) -> str:
        """Generate timezone identifier."""
    
    def gmt_offset(self) -> str:
        """Generate GMT offset string like '+05:00'."""
    
    def week_date(self, start: int = 2017, end: int = 2023) -> str:
        """Generate ISO week date."""
    
    def periodicity(self) -> str:
        """Generate periodicity description."""

Usage Examples

from mimesis import Datetime
from mimesis.enums import TimezoneRegion

dt = Datetime()

# Basic date/time generation
random_date = dt.date(start=2020, end=2023)
random_time = dt.time()
random_datetime = dt.datetime()

# Formatted output
formatted_date = dt.formatted_date(fmt="%Y-%m-%d")      # "2023-05-15"
formatted_time = dt.formatted_time(fmt="%H:%M:%S")      # "14:30:25"

# Timezone information
timezone = dt.timezone(TimezoneRegion.EUROPE)           # "Europe/London"
gmt_offset = dt.gmt_offset()                            # "+02:00"

Install with Tessl CLI

npx tessl i tessl/pypi-mimesis

docs

configuration.md

core-providers.md

datetime.md

financial-data.md

index.md

internet-data.md

location-data.md

personal-data.md

schema.md

specialized-providers.md

text-content.md

tile.json