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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to read as if it was first day of month

Status
Not open for further replies.

mheilbut

Programmer
Apr 24, 2002
53
0
0
BR
I have a PERL program and one of the tests in it is the following:

#today's date
$tday = $t[3];
$tday = &quot;0&quot; . $tday if ($tday < 10);
#if today is the first day of the month
if ($tday eq &quot;01&quot;)
{
#and if the month is January
if ($tmon eq &quot;01&quot;)
{
# make the month December
$tmon = 12;
}
else
{
#subtract 1 from the variable that contains the month
$tmon--;
}
}

I want to test if this works. Is there a way I can fool the system so that it thinks that $tday is actually the first day of the month? Michel, São Paulo, Brazil
 
You can use the date command to set the date to anything you want. Another way to test your code is to set your variable $tday to '01'.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top