Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do i find which day it is, give 2

Status
Not open for further replies.

ktsrikanth

Programmer
Feb 6, 2001
22
0
0
US
How do i find which day it is, given the date in 'DD-MMM-YY' format?
 
[tt]$date =~ m/^(\d\d)-(\w\w\w)-(\d\d)$/;
$day = $1;
$month = $2;
$year = $3;
[/tt]


you should research regular expressions. "If you think you're too small to make a difference, try spending a night in a closed tent with a mosquito."
 
Hi,
Thank for the response.
I want to know, if it is Monday, Tuesday or so on....
 
[tt]
use Time::Local;
$your_date =~ m/^(\d\d)-(\w\w\w)-(\d\d)$/;
%months = ('Jan' => 0, 'Feb' => 1, ...etc.);

$reform = timelocal(0,0,0,$1,$months{$2},$3);
@localized = localtime($reform);
$day_of_week = $localized[6];
[/tt]
"If you think you're too small to make a difference, try spending a night in a closed tent with a mosquito."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top