RE: getting date from localtime

2002-06-25 Thread Shishir K. Singh

Howdy:

I'm trying to do the following (which may have
been created already) in perl:

* create two variables

var1 = this will be sunday of current week always
var2 = this will be saturday of current week always

I'm not sure how I can use 'localtime' as a tool
for identifying var1 and var2.

I mean, I think I can work around this:

($mday, $mon, $year) = (localtime())[3 .. 5];

Which gives me day-of-month, month and year, but
how to used that as a focal point to get
that saturday and sunday of the current week
without some silly if-then-else loop.

Perhaps I am going about this the wrong way.
It seems like var1 and var2 will actually be
large formulas.

Suggestions?

perldoc -f localtime

element 6 gives the weekday..will that help ??

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: getting date from localtime

2002-06-25 Thread Shishir K. Singh



Howdy:

I'm trying to do the following (which may have
been created already) in perl:

* create two variables

var1 = this will be sunday of current week always
var2 = this will be saturday of current week always

I'm not sure how I can use 'localtime' as a tool
for identifying var1 and var2.

I mean, I think I can work around this:

($mday, $mon, $year) = (localtime())[3 .. 5];

Which gives me day-of-month, month and year, but
how to used that as a focal point to get
that saturday and sunday of the current week
without some silly if-then-else loop.

Perhaps I am going about this the wrong way.
It seems like var1 and var2 will actually be
large formulas.

Suggestions?

perldoc -f localtime
element 6 gives the weekday..will that help ??
Oops..I meant index 6 and not element!!


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: getting date from localtime

2002-06-25 Thread drieux


On Tuesday, June 25, 2002, at 07:01 , Johnson, Shaunn wrote:

 ($mday, $mon, $year) = (localtime())[3 .. 5];


have you thought about the off set values of $wday?

my ($mday, $mon, $year,$wday) = (localtime())[3 .. 6];
$year += 1900;
my $k_mon = $mon + 1;

my @day_oh_week = qw/Sun Mon Tues Wens Thur Fri Sat/;

print $mday, $mon, $year,$wday\n;

print $day_oh_week[0] falls on , ($mday - $wday) , \n;
print $day_oh_week[6] falls on , ($mday + (6 - $wday)) , \n;

ciao
drieux

---


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]