NAME
    Filename::Timestamp - Extract date/timestamp from filename, if any

VERSION
    This document describes version 0.001 of Filename::Timestamp (from Perl
    distribution Filename-Timestamp), released on 2024-12-21.

SYNOPSIS
     use Filename::Archive qw(check_archive_filename);
     my $res = check_archive_filename(filename => "foo.tar.gz");
     if ($res) {
         printf "File is an archive (type: %s, compressed: %s)\n",
             $res->{archive_name},
             $res->{compressor_info} ? "yes":"no";
     } else {
         print "File is not an archive\n";
     }

DESCRIPTION
FUNCTIONS
  extract_timestamp_from_filename
    Usage:

     extract_timestamp_from_filename(%args) -> bool|hash

    Extract date/timestamp from filename, if any.

    Examples:

    *   Example #1:

         extract_timestamp_from_filename(filename => "2024-09-08T12_35_48+07_00.JPEG");

        Result:

         {
           day    => 8,
           epoch  => 1725773748,
           hour   => 12,
           minute => 35,
           month  => 9,
           second => 48,
           year   => 2024,
         }

    *   Example #2:

         extract_timestamp_from_filename(filename => "IMG_20240908_095444.jpg");

        Result:

         {
           day    => 8,
           epoch  => 1725764084,
           hour   => 9,
           minute => 54,
           month  => 9,
           second => 44,
           year   => 2024,
         }

    *   Example #3:

         extract_timestamp_from_filename(filename => "VID_20240908_092426.mp4");

        Result:

         {
           day    => 8,
           epoch  => 1725762266,
           hour   => 9,
           minute => 24,
           month  => 9,
           second => 26,
           year   => 2024,
         }

    *   Example #4:

         extract_timestamp_from_filename(filename => "Screenshot_2024-09-01-11-40-44-612_org.mozilla.firefox.jpg");

        Result:

         {
           day    => 1,
           epoch  => 1725165644,
           hour   => 11,
           minute => 40,
           month  => 9,
           second => 44,
           year   => 2024,
         }

    *   Example #5:

         extract_timestamp_from_filename(filename => "IMG-20241204-WA0001.jpg");

        Result:

         {
           day    => 4,
           epoch  => 1733245200,
           hour   => 0,
           minute => 0,
           month  => 12,
           second => 0,
           year   => 2024,
         }

    *   Example #6:

         extract_timestamp_from_filename(filename => "foo.txt"); # -> 0

    This function is not exported by default, but exportable.

    Arguments ('*' denotes required arguments):

    *   all => *bool*

        Find all timestamps instead of the first found only.

        Not yet implemented.

    *   filename* => *str*

        (No description)

    Return value: (bool|hash)

    Return false if no timestamp is detected. Otherwise return a hash of
    information, which contains these keys: "epoch", "year", "month", "day",
    "hour", "minute", "second".

HOMEPAGE
    Please visit the project's homepage at
    <https://metacpan.org/release/Filename-Timestamp>.

SOURCE
    Source repository is at
    <https://github.com/perlancar/perl-Filename-Timestamp>.

SEE ALSO
    Filename::Compressed

AUTHOR
    perlancar <perlancar@cpan.org>

CONTRIBUTING
    To contribute, you can send patches by email/via RT, or send pull
    requests on GitHub.

    Most of the time, you don't need to build the distribution yourself. You
    can simply modify the code, then test via:

     % prove -l

    If you want to build the distribution (e.g. to try to install it locally
    on your system), you can install Dist::Zilla,
    Dist::Zilla::PluginBundle::Author::PERLANCAR,
    Pod::Weaver::PluginBundle::Author::PERLANCAR, and sometimes one or two
    other Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps
    required beyond that are considered a bug and can be reported to me.

COPYRIGHT AND LICENSE
    This software is copyright (c) 2024 by perlancar <perlancar@cpan.org>.

    This is free software; you can redistribute it and/or modify it under
    the same terms as the Perl 5 programming language system itself.

BUGS
    Please report any bugs or feature requests on the bugtracker website
    <https://rt.cpan.org/Public/Dist/Display.html?Name=Filename-Timestamp>

    When submitting a bug or request, please include a test-file or a patch
    to an existing test-file that illustrates the bug or desired feature.

