# info > Date::Manip::DM5

---
type: CommandReference
command: Date::Manip::DM5
mode: perldoc
section: 3pm
source: perldoc
---

## Quick Reference
- `ParseDate("today")` — parse a date string into internal format
- `UnixDate($date,"%Y-%m-%d %H:%M:%S")` — format a date
- `DateCalc($date,"+ 1 day 2 hours")` — add/subtract time from a date
- `ParseDateDelta("+ 1 day 2 hours")` — parse a time delta
- `ParseRecur("1*0:0:1:0:0:0*")` — define a recurring event (every month 1st)
- `Date_Cmp($date1,$date2)` — compare two dates
- `Date_Init("Language=French","DateFormat=non-US")` — configure Date::Manip
- `Date_ConvTZ($date,"EST","PST")` — convert time zones

## Name
`Date::Manip::DM5` — Date manipulation routines

## Synopsis
perl
use Date::Manip;

$version = DateManipVersion;

Date_Init();                              # or with key=value arguments
@list = Date_Init();

$date = ParseDate(\@args);               # date from array or string
$date = ParseDate($string);
$date = ParseDate(\$string);

@date = UnixDate($date,@format);
$date = UnixDate($date,@format);

$delta = ParseDateDelta(\@args);         # parse delta (time span)
$delta = ParseDateDelta($string);
$delta = ParseDateDelta(\$string);

@str = Delta_Format($delta,$dec,@format);
$str = Delta_Format($delta,$dec,@format);

$recur = ParseRecur($string,$base,$date0,$date1,$flags);
@dates = ParseRecur($string,$base,$date0,$date1,$flags);

$flag = Date_Cmp($date1,$date2);
$d = DateCalc($d1,$d2 [,$errref] [,$del]);

$date = Date_SetTime($date,$hr,$min,$sec);
$date = Date_SetTime($date,$time);

$date = Date_SetDateField($date,$field,$val [,$nocheck]);

$date = Date_GetPrev($date,$dow,$today,$hr,$min,$sec);
$date = Date_GetPrev($date,$dow,$today,$time);
$date = Date_GetNext($date,$dow,$today,$hr,$min,$sec);
$date = Date_GetNext($date,$dow,$today,$time);

$name = Date_IsHoliday($date);
$listref = Events_List($date);
$listref = Events_List($date0,$date1);

$date = Date_ConvTZ($date);
$date = Date_ConvTZ($date,$from);
$date = Date_ConvTZ($date,"",$to);
$date = Date_ConvTZ($date,$from,$to);

$flag = Date_IsWorkDay($date [,$flag]);
$date = Date_NextWorkDay($date,$off [,$flag]);
$date = Date_PrevWorkDay($date,$off [,$flag]);
$date = Date_NearestWorkDay($date [,$tomorrowfirst]);

# Internal fast functions (require explicit Date_Init)
$day  = Date_DayOfWeek($m,$d,$y);
$secs = Date_SecsSince1970($m,$d,$y,$h,$mn,$s);
$secs = Date_SecsSince1970GMT($m,$d,$y,$h,$mn,$s);
$days = Date_DaysSince1BC($m,$d,$y);
$day  = Date_DayOfYear($m,$d,$y);
($y,$m,$d,$h,$mn,$s) = Date_NthDayOfYear($y,$n);
$days = Date_DaysInYear($y);
$days = Date_DaysInMonth($m,$y);
$wkno = Date_WeekOfYear($m,$d,$y,$first);
$flag = Date_LeapYear($y);
$day  = Date_DaySuffix($d);
$tz   = Date_TimeZone();
## Options (Configuration Variables)
These variables can be set via `Date_Init("VAR=VAL")`, a config file, or at the top of `Manip.pm`.

- `IgnoreGlobalCnf` — when present, ignore the global configuration file
- `EraseHolidays` — when present, clear the holiday list before reloading
- `PathSep` — regular expression for separating path lists (default `:` on Unix, `;` on Win32)
- `GlobalCnf` — full path to a global config file
- `PersonalCnf` — name of the personal config file (default `.DateManip.cnf` on Unix, `Manip.cnf` on other)
- `PersonalCnfPath` — list of directories to search for `PersonalCnf` (separated by `PathSep`)
- `Language` — language for date parsing (one of: `English`(default), `French`, `Swedish`, `German`, `Dutch`, `Polish`, `Spanish`, `Portuguese`, `Romanian`, `Italian`, `Russian`, `Turkish`, `Danish`)
- `DateFormat` — `US` (month/day) or other (day/month) for numeric dates
- `TZ` — local time zone in `STD#DST` or one of the recognized abbreviations
- `ConvTZ` — time zone into which all parsed dates are converted; empty = local time zone, `IGNORE` = keep as entered
- `Internal` — `0` for old format `YYYYMMDDHH:MN:SS`, `1` for `YYYYMMDDHHMNSS`
- `FirstDay` — first day of week (1=Monday, 7=Sunday)
- `WorkWeekBeg` / `WorkWeekEnd` — numeric days (1=Mon … 7=Sun) for business week
- `WorkDay24Hr` — if true, workday is 24 hours (ignores begin/end)
- `WorkDayBeg` / `WorkDayEnd` — start and end time of workday (e.g., `08:00`)
- `TomorrowFirst` — search forward first for nearest workday (1=yes, 0=no)
- `DeltaSigns` — if non-zero, store deltas with a sign on every component
- `Jan1Week1` — if non-zero, week 1 always contains Jan 1 (non-ISO)
- `YYtoYYYY` — integer N, `C`, `C##`, or `C####` to map 2‑digit years (default C89 to C+10)
- `UpdateCurrTZ` — if non-zero, check time zone at each parse (slow)
- `IntCharSet` — `0` for US ASCII, `1` for international character set
- `ForceDate` — force current date to a fixed value in `YYYY-MM-DD-HH:MN:SS`
- `TodayIsMidnight` — true means “today” = midnight today; false means “now”

## Time Zones
`Date::Manip` relies on zoneinfo (Olson) data in version 6.x; the 5.x version described here supports a fixed list. Recognised input formats:

- RFC 822: `EST`, `EDT`, `CST`, `CDT`, `MST`, `MDT`, `PST`, `PDT`, `GMT`, `UT`, military A–Z (except J)
- Offsets: `+HHMM`, `-HHMM`, ISO 8601 `+HH:MM`, `-HH:MM`, `+HH`, `-HH`
- A legacy list of abbreviations (see `Date::Manip::DM5abbrevs`) is also supported.

To set the local time zone, `Date::Manip` checks:
- `$Date::Manip::TZ` (set via `Date_Init` or `Manip.pm`)
- `$ENV{TZ}`
- the Unix `date` command
- `$main::TZ`
- `/etc/TIMEZONE`
- `/etc/time zone`

If none provide a recognized value, `Date_Init` must be called with `TZ`.

## Holidays and Events Section
In a config file, lines starting with `*Holiday` or `*Event` define named periods.

**Holiday format:** `DATE = HOLIDAY_NAME` (name optional). `DATE` can be:
- a plain date (e.g., `1/1`)
- `Date + Delta` or `Date - Delta`
- a recurrence (see `ParseRecur`)

All holidays are full-day events from midnight to midnight. They affect business-mode calculations.

**Event format:** `EVENT_SPEC = NAME`  
`EVENT_SPEC` can be:
- `Date` or `Date*` (date without time = 24h, with time = 1h duration)
- `Date ; Date`, `Date ; Delta`, `Recur ; Delta`, `Recur ; Delta ; Delta`

Events are ignored in business-mode math. Multiple overlapping events are handled in the tally.

## Examples
perl
use Date::Manip;
Date_Init("DateFormat=non-US");                # day/month parsing

# Parse and format a date
$date = ParseDate("12/10/2025");               # Oct 12, 2025
($y,$m,$d) = UnixDate($date,"%Y","%m","%d");

# Add a month and two days
$next = DateCalc("2025-03-31","+ 1 month 2 days");   # => 20250502

# Recurrence: every other Monday at 9:00
@mondays = ParseRecur("0:0:2*1:0:0:0","20250101","20250101","20251231");

# Delta format: hours and minutes
$delta = ParseDateDelta("2 days -3 hours");
($d,$h) = Delta_Format($delta,0,"%dt","%ht");    # 1.875 days, 45 hours

# Business day calculation (requires config file with work hours and holidays)
$holiday = Date_IsHoliday("20251225");
$next_wd = Date_NextWorkDay("20251224",1,1);     # next workday including time
## See Also
- [Date::Manip](https://metacpan.org/pod/Date::Manip) — main module documentation
- [Date::Manip::DM5abbrevs](https://metacpan.org/pod/Date::Manip::DM5abbrevs) — list of time zone abbreviations
- [Date::Manip::Calc](https://metacpan.org/pod/Date::Manip::Calc) — business‑mode notes
- [Date::Manip::Problems](https://metacpan.org/pod/Date::Manip::Problems) — bug reporting

## Exit Codes
Not documented.