You could probably use something like Date::Manip or some of the other 
routines, but believe this would add a lot of overhead.  Here is a small script which 
does the basics(you should be able to pull out what would constitute a sub). I just 
wanted to show you with a little code you could generate what you need.

        It finds the first of the current year and then works off of that.  With 
slight mods it should work with any year being passed as along as you pull the 
dayofweek number.       I set it up as a test for year 2004.
#!perl -w

use strict;

use Time::Local;

my @TI = ();
my $TimeInfo = [EMAIL PROTECTED];

my $MyStartOfYear = timelocal(0,0,0,1,0,104);   #start of year for 2004

@TI = localtime($MyStartOfYear);
$TimeInfo->[4]++;
printf "%02d/%02d/%4d-%02d:%02d:%02d-%d/%3d\n",
                                                                $TimeInfo->[4],
                                                                $TimeInfo->[3],
                                                                $TimeInfo->[5]+1900,
                                                                $TimeInfo->[2],
                                                                $TimeInfo->[1],
                                                                $TimeInfo->[0],
                                                                $TimeInfo->[6],
                                                                $TimeInfo->[7];
my $MyStartYear      = $TimeInfo->[5];
my $MyStartDayOfWeek = $TimeInfo->[6];
my @MyWorka = ();
my $MyCurrWeek;
my $MyCurrPointInTime;
my $MyResp;

while ( 1 ) {
        printf "Please enter date w/in year(as mm/dd) or Exit:";
        chomp($MyResp = <STDIN>);
        if ( $MyResp eq '' ) {
                $MyResp = 'ex';
         }
        last if ( $MyResp =~/^ex/i );
        @MyWorka = split(/\D+/, $MyResp);
        $MyCurrPointInTime = timelocal(0,0,12,$MyWorka[1],($MyWorka[0]-1), 
$MyStartYear);
        @TI = localtime($MyCurrPointInTime);
        $TimeInfo->[4]++;
        $MyCurrWeek = int($TimeInfo->[7]/7)+1;
        $MyCurrWeek++ if ($TimeInfo->[6] < $MyStartDayOfWeek);
        printf "%02d/%02d/%4d-%02d:%02d:%02d-%d/%3d->%3d\n",
                                                                $TimeInfo->[4],
                                                                $TimeInfo->[3],
                                                                $TimeInfo->[5]+1900,
                                                                $TimeInfo->[2],
                                                                $TimeInfo->[1],
                                                                $TimeInfo->[0],
                                                                $TimeInfo->[6],
                                                                $TimeInfo->[7],
                                                                $MyCurrWeek;
        
 }


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 22, 2004 11:28 
To: [EMAIL PROTECTED]
Subject: Covert Date to week number


Is their a way in PERL to covert a date to a week number


Cheers

Neill





********************
IMPORTANT NOTICE  This email (including any attachments) is meant only for the 
intended recipient. It may also contain confidential and privileged information.  If 
you are not the intended recipient, any reliance on, use, disclosure, distribution or 
copying of this email or attachments is strictly prohibited. Please notify the sender 
immediately by email if you have received this message by mistake and delete the email 
and all attachments. 

Any views or opinions in this email are solely those of the author and do not 
necessarily represent those of Trinity Mirror PLC or its associated group companies 
(hereinafter referred to as "TM Group"). TM Group accept no liability for the content 
of this email, or for the consequences of any actions taken on the basis of the 
information provided, unless that information is subsequently confirmed in writing. 
Although every reasonable effort is made to keep its network free from viruses, TM 
Group accept no liability for any virus transmitted by this email or any attachments 
and the recipient should use up-to-date virus checking software. Email to or from this 
address may be subject to interception or monitoring for operational reasons or for 
lawful business practices. 

Trinity Mirror PLC is the parent  company of the Trinity Mirror group of companies and 
is registered in England No 82548, with its address at One Canada Square, Canary 
Wharf, London E14 5AP. 
********************

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




**********************************************************
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.
****************************************************************


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to