In the end you'll notice it just takes a couple of lines of code to do it - whatever you may write yourself will be longer and more error prone. See this example:
use Date::Manip;
$main::TZ = "CET";
my $ds = '2003/10/19'; # it's a sunday
my $d = &ParseDate( $ds );
print "$ds = $d \n";
my $d2 = &DateCalc( $d,"+ 3hours 12minutes 6 seconds", \$err);
print "$d2\n";
my $d3 = &DateCalc( $d,"+ 5 business days", \$err);
print "$d3\n";
Note how you can even use business days when doing date operations (that's why $d3 looks weird at first...). I think it's no point reinventing the wheel. :-)
On the other side, Date::Manip is big and slow, so if you have to compute thousands or millions of operations with it in a few seconds, it's not likely the way to go....
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.