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!

Simple Date Question???

Status
Not open for further replies.

daveniemann

IS-IT--Management
Aug 25, 2002
7
0
0
US
New Perl devleoper here!!

Im trying to extract, given the current date, the day of the month....Ie... If the date is June 12th, 2003---I'd like to return just the 12 in a variable.

Thanks in advance!
 
($seconds, $minutes, $hour, $dayOfMonth, $month, $year, $dayOfWeek, $dayOfYear) = localtime(time);

[red]print "current dayOfMonth is: $dayOfMonth\n";[/red]

$month ++;
print "current month is: $month\n";

$year += 1900;
print "current year is: $year\n";

Duncan
 
hello duncan
what about the perl date module
what I did not understand in your answer is

($seconds, $minutes, $hour, $dayOfMonth, $month, $year, $dayOfWeek, $dayOfYear) = localtime(time);

print "current dayOfMonth is: $dayOfMonth\n";

$month ++;
print "current month is: $month\n";

$year += 1900;
print "current year is: $year\n";

-----------------------------------------------------------
If we want to display the current date
i.e in 28/04/04 format then


 
Code:
($seconds, $minutes, $hour, $dayOfMonth, $month, $year, $dayOfWeek, $dayOfYear) = localtime(time);
$month++;
print "$dayOfMonth/$month/$year";
HTH
--Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top