NAME

AmberDB::Date - Date manipulation, formatting, and date ID utility

SYNOPSIS

use AmberDB::Date;
my $date = AmberDB::Date->new();
my $date_hash = $date->get_date();
my $date_id   = $date->str2dateid('2023-10-01');
my $str       = $date->dateid2str('20231001');

DESCRIPTION

AmberDB::Date provides methods for date parsing, ID conversions (YYYYMMDDHHMMSS), date range generation, offset calculations, and localized date string formatting.

METHODS

new([\%options])

Constructor for AmberDB::Date. Optionally accepts custom month/day name arrays.

get_date([$timestamp])

Returns detailed date component hash for current or given timestamp.

str2dateid($datestr)

Converts date strings into numeric date IDs.

dateid2str($dateid)

Converts numeric date IDs back into human readable strings.

time2str([$timestamp])

Formats epoch time to HTTP/email compatible date string.

day_range($start_dateid, $end_dateid)

Generates list of day IDs within given date range.

dateid2week($dateid)

Calculates ISO week number and day index for date ID.

offset2date($offset_string)

Calculates new date ID based on relative offset (e.g. "-2D", "1M").

MonthDaysInYear([$year_offset])

Returns month index and days per month list for offset year.

AUTHOR

Maruf Cetin <marufcetin@gmail.com>

LICENSE AND COPYRIGHT

Copyright (C) 2008-2026 Maruf Cetin.

This library is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0.