EAI::DateUtil - Date and Time helper functions for EAI::Wrap
%months = ("Jan" => "01","Feb" => "02","Mar" => "03","Apr" => "04","May" => "05","Jun" => "06","Jul" => "07","Aug" => "08","Sep" => "09","Oct" => "10","Nov" => "11","Dec" => "12"); %monate = ("Jan" => "01","Feb" => "02","Mär" => "03","Apr" => "04","Mai" => "05","Jun" => "06","Jul" => "07","Aug" => "08","Sep" => "09","Okt" => "10","Nov" => "11","Dez" => "12"); get_curdate () get_curdatetime () get_curdate_dot () formatDate ($d, $m, $y, [$template]) formatDateFromYYYYMMDD($date, [$template]) get_curdate_gen ([$template]) get_curdate_dash () get_curdate_dash_plus_X_years ($years) get_curtime () get_curtime_HHMM () get_lastdateYYYYMMDD () get_lastdateDDMMYYYY () is_first_day_of_month ($date YYYYMMDD) is_last_day_of_month ($date YYYYMMDD, [$hol]) get_last_day_of_month ($date YYYYMMDD) weekday ($date YYYYMMDD) is_weekend ($date YYYYMMDD) is_holiday ($hol, $date YYYYMMDD) first_week ($d,$m,$y,$day,[$month]) first_weekYYYYMMDD ($date,$day,[$month]) last_week ($d,$m,$y,$day,[$month]) last_weekYYYYMMDD ($date,$day,[$month]) convertDate ($date YYYY.MM.DD or YYYY/MM/DD) convertDateFromMMM ($inDate dd-mmm-yyyy, out $day, out $mon, out $year) convertDateToMMM ($day, $mon, $year) convertToDDMMYYYY ($date YYYYMMDD) addDays ($day, $mon, $year, $dayDiff) addDaysHol ($date, $days, [$template, $hol]) addDatePart ($date, $count, $datepart, [$template]) subtractDays ($date, $days) subtractDaysHol ($date, $days, [$template, $hol]) convertcomma ($number, $divideBy) convertToThousendDecimal($value, $ignoreDecimal) get_dateseries parseFromDDMMYYYY ($dateStr) parseFromYYYYMMDD ($dateStr) convertEpochToYYYYMMDD ($epoch)
EAI::DateUtil contains all date/time related API-calls.
conversion hash english months -> numbers, usage: $months{"Oct"} equals 10
conversion hash german months -> numbers, usage: $monate{"Okt"} equals 10
gets current date in format YYYYMMDD
gets current datetime in format YYYYMMDD_HHMMSS
gets current date in format DD.MM.YYYY
formats passed date (given in arguments $y,$m,$d) into format as defined in $template
$d .. day part $m .. month part $y .. year part $template .. optional, date template with D for day, M for month and Y for year (e.g. D.M.Y for 01.02.2016), D and M is always 2 digit, Y always 4 digit; if empty/nonexistent defaults to "YMD" special formats are MMM und mmm als monthpart, here three letter month abbreviations in english (MMM) or german (mmm) are returned as month
formats passed date (given in argument $date) in format as defined in $template
$date .. date in format YYYYMMDD $template .. same as in formatDate
returns current date in format as defined in $template
$template .. same as in formatDate
returns current date in format DD-MM-YYYY
$y .. years to be added to the current or given date $year,$mon,$day .. optional date to which X years should be added (if not given current date is taken instead). $daysToSubtract .. days that should be subtracted from the result
returns current time in format HH:MM:SS (or as given in formatstring $format, however ordering of format is always hour, minute and second)
$format .. optional sprintf format string (e.g. %02d:%02d:%02d) for hour, minute and second
returns current time in format HHMM
returns 1 if first day of months, 0 else
$date .. date in format YYYYMMDD
returns 1 if last day of month, 0 else
$date .. date in format YYYYMMDD $hol .. optional, calendar for holidays used to get the last of month
returns last day of month of passed date
returns 1..sunday to 7..saturday
returns 1 if saturday or sunday
returns 1 if weekend or holiday
$hol .. holiday calendar; currently supported: AT (Austria), TG (Target), UK (see is_holiday) and WE (for only weekends). throws error if calendar not supported (Hashlookup). $date .. date in format YYYYMMDD
returns 1 if given date ($d,$m,$y) is the last given weekday ($day: 0 - 6, sunday==0) in given month ($month), if $month is not passed, then it is taken from passed date.
$d .. day part $m .. month part $y .. year part $day .. given weekday $month .. optional, given month
returns 1 if given date ($date in Format YYYYMMDD) is the last given weekday ($day: 0 - 6, sunday==0) in given month ($month), if $month is not passed, then it is taken from passed date.
$date .. given date $day .. given weekday $month .. optional, given month
returns 1 if given date ($d,$m,$y) is the first given weekday ($day: 0 - 6, sunday==0) in given month ($month), if $month is not passed, then it is taken from passed date.
returns 1 if given date ($date in Format YYYYMMDD) is the first given weekday ($day: 0 - 6, sunday==0) in given month ($month), if $month is not passed, then it is taken from passed date.
converts given date to format YYYYMMDD
$date .. date in format YYYY.MM.DD or YYYY/MM/DD
converts date from format dd-mmm-yyyy (01-Oct-05, english !), returns date in format DD.MM.YYYY ($day, $mon, $year are returned by ref as well)
$inDate .. date to be converted $day .. ref for day part $mon .. ref for month part $year .. ref for year part
converts date into ($day, $mon, $year) from format dd-mmm-yyyy (01-Oct-05, english !)
$day .. day part $mon .. month part $year .. year part
converts date into $datestring (dd.mm.yyyy) from format YYYYMMDD
adds $dayDiff to date ($day, $mon, $year) and returns in format dd-mmm-yyyy (01-Oct-05, english !), arguments $day, $mon, $year are returned by ref as well if not passed as literal
$day .. day part $mon .. month part $year .. year part $dayDiff .. days to be added
subtracts $days actual calendar days from $date
$date .. date in format YYYYMMDD $days .. calendar days to subtract
subtracts $days days from $date and regards weekends and holidays of passed calendar
$date .. date in format YYYYMMDD $days .. calendar days to subtract $template .. as in formatDate $hol .. holiday calendar; currently supported: NO (no holidays = default if not given), rest as in is_holiday
adds $days days to $date and regards weekends and holidays of passed calendar
$date .. date in format YYYYMMDD $days .. calendar days to add $template .. as in formatDate $hol .. holiday calendar; currently supported: NO (no holidays = default if not given), rest as in is_holiday
adds $count dateparts to $date. when adding to months ends (>28 in february, >29 or >30 else), if the month end is not available in the target month, then date is moved into following month
$date .. date in format YYYYMMDD $count .. count of dateparts to add $datepart .. can be "d" or "day" for days, "m"/"mon"/"month" for months and "y" or "year" for years $template .. as in formatDate
returns last business day (only weekends, no holiday here !) in format YYYYMMDD
returns last business day (only weekends, no holiday here !) in format DDMMYYYY
converts decimal point in $number to comma, also dividing by $divideBy before if $divideBy is set
$number .. number to be converted $divideBy .. number to be divided by
converts $value into thousand separated decimal (german format) ignoring decimal places if wanted
$value .. number to be converted $ignoreDecimal .. return number without decimal places (truncate)
returns date values (format YYYYMMMDD) starting at $fromDate until $toDate, if a holiday calendar is set in $hol (optional), these holidays (incl. weekends) are regarded as well.
$fromDate .. start date $toDate .. end date $hol .. holiday calendar
returns time epoch from datestring (dd.mm.yyyy)
$dateStr .. datestring
returns time epoch from datestring (yyyymmdd)
returns datestring (yyyymmdd) from epoch/Time::piece
$arg .. date either as epoch (seconds since 1.1.1970) or as Time::piece object
Copyright (c) 2023 Roland Kapl
All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
1 POD Error
The following errors were encountered while parsing the POD:
Non-ASCII character seen before =encoding in '"02","Mär"'. Assuming UTF-8
To install EAI::Wrap, copy and paste the appropriate command in to your terminal.
cpanm
cpanm EAI::Wrap
CPAN shell
perl -MCPAN -e shell install EAI::Wrap
For more information on module installation, please visit the detailed CPAN module installation guide.