Hey all, I was trying to do some "stuff" if a condition was tru based on time.
Here is how I was hoping it will work:
if Today eq 5days_lest_then_end_of_month;
do stuff
else
skipp
I know it seems simple but what if i told you that those five days have to be business days.
Look at what i had so far thanks to a friend:-)
#!/usr/local/bin/perl -w
use diagnostics;
use strict;
use Date::Calc qw(:all);
use Date::Calendar;
use Date::Calendar::Profiles qw( $Profiles );
my $cal = Date::Calendar->new( $Profiles->{'DE-NW'} ); # or wherever y
+ou are
my @today = Today();
my @date = Add_Delta_YM($today[0],$today[1],1, 0,1); # first of next m
+onth
my $date = $cal->add_delta_workdays(@date,-5); # 5 business days befor
+e that
#my $date = $cal->add_delta_workdays(@date,-5); # 5 business days befo
+re that
$date->date_format(2);
print "date = $date\n";
print "today = @today\n";
This prints out:
date = Fri 23-Nov-2001
today = 2001 11 21
So i guess the question is that all i need is to somehow rearrange these dates in a standard form so i can use it in that conditional. As always, any suggestions will be very helpful...Thanks
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.