in reply to Re: How to get the current Date and Time using Perl on windows?
in thread How to get the current Date and Time using Perl on windows?
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>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: How to get the current Date and Time using Perl on windows?
by McDarren (Abbot) on Jan 03, 2008 at 01:15 UTC | |
by goibhniu (Hermit) on Jan 03, 2008 at 16:41 UTC |