---
name: "Data::Fake::Dates"
section: "3pm"
platform: "linux"
package: "libdata-fake-perl"
version: "0.006-3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Data::Fake::Dates"
---

# Data::Fake::Dates(3pm)

Fake date data generators

## NAME

Data::Fake::Dates - Fake date data generators

## VERSION

version 0.006

## SYNOPSIS

```
    use Data::Fake::Dates;
    $past   = fake_past_epoch()->();
    $future = fake_future_epoch()->();
    $past   = fake_past_datetime()->();     # ISO-8601 UTC
    $future = fake_future_datetime()->();   # ISO-8601 UTC
    $past   = fake_past_datetime("%Y-%m-%d")->();
    $future = fake_future_datetime("%Y-%m-%d")->();
```

## DESCRIPTION

This module provides fake data generators for past and future dates and times.

All functions are exported by default.

## FUNCTIONS

### fake\_past\_epoch

```
    $generator = fake_past_epoch();
```

This returns a generator that gives a randomly-selected integer number of seconds between the Unix epoch and the current time.

### fake\_future\_epoch

```
    $generator = fake_future_epoch();
```

This returns a generator that gives a randomly-selected integer number of seconds between the the current time and a period as far into the future as the Unix epoch is in the past (i.e. about 45 years as of 2015).

### fake\_past\_datetime

```
    $generator = fake_past_datetime();
    $generator = fake_past_datetime("%Y-%m-%d");
    $generator = fake_past_datetime($strftime_format);
```

This returns a generator that selects a past datetime like `"fake_past_epoch"` does but formats it as a string using FreeBSD-style `"strftime"` formats.  (See Time::Piece for details.)

The default format is ISO8601 UTC "Zulu" time (`"%Y-%m-%dT%TZ"`).

### fake\_future\_datetime

```
    $generator = fake_future_datetime();
    $generator = fake_future_datetime("%Y-%m-%d");
    $generator = fake_future_datetime($strftime_format);
```

This returns a generator that selects a future datetime like `"fake_future_epoch"` does but formats it as a string using FreeBSD-style `"strftime"` formats.  (See Time::Piece for details.)

The default format is ISO8601 UTC "Zulu" time (`"%Y-%m-%dT%TZ"`).

## AUTHOR

David Golden \<dagolden@cpan.org\>

## COPYRIGHT AND LICENSE

This software is Copyright (c) 2015 by David Golden.

This is free software, licensed under:

```
  The Apache License, Version 2.0, January 2004
```
