As everyone has pointed out, there are much better, more perlish ways to do it, but here my $0.02 in the interest of TIMTOWTDI in case you're in a DOS batch file mindset.
First, date /? reports:
Displays or sets the date. DATE [/T | date] Type DATE without parameters to display the current date setting and a prompt for a new one. Press ENTER to keep the same date. If Command Extensions are enabled the DATE command supports the /T switch which tells the command to just output the current date, without prompting for a new date.
If Command Extensions are missing, you can pipe the ENTER like this:
echo.|date
which is a little harder to parse, but also doesn't require setting the date.
C:\chas_sandbox>perl -le "print `date /T`" Wed 01/02/2008 C:\chas_sandbox>perl -le "print `echo.\|date`" The current date is: Wed 01/02/2008 Enter the new date: (mm-dd-yy) C:\chas_sandbox>
In reply to Re^2: How to get the current Date and Time using Perl on windows?
by goibhniu
in thread How to get the current Date and Time using Perl on windows?
by Ethen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |