I am in the process of trying to obtain the hours and minutes from these lines of code and am having difficulty.
I can return the Year, Month and Day but the challenge is the Hours and Minutes.
Your assistance is appreciated.
John
I am in the process of trying to obtain the hours and minutes from these lines of code and am having difficulty.
I can return the Year, Month and Day but the challenge is the Hours and Minutes.
Your assistance is appreciated.
John

This month, every Windows Secrets subscriber can download a one-chapter excerpt of Windows 7: The Missing Manual.Windows 7: The Missing Manual provides valuable information to help you overcome these difficulties in learning a new operating system. Subscribe today to download your free excerpt.
There are a number of these BATch file 'functions' around. Yours looks uncannily similar to those by Ritchie Lawrence!
If you can understand the workings of the one you've got, try this one:<pre>:: generalised DATE and TIME routine for NT4/W2K/WXP and all Regional Settings
:: %yy% will contain four digits, 20nn;
:: %mm%, %dd% and time variables %hr%, %mn%, %sc% and %th% contain two digits
if "%date%A" LSS "A" (set toks=1-3) else (set toks=2-4)
for /f "skip=1 tokens=2-4 delims=(-)" %%a in ('echo.^|date') do (
for /f "tokens=%toks% delims=.-/ " %%e in ('date /t') do (
for /f "tokens=5-8 delims=:., " %%i in ('echo.^|time') do (
(set %%a=%%e) & (set %%b=%%f) & (set %%c=%%g) & rem create yy, mm, dd
(set hr=%%i) & (set mn=%%j) & (set sc=%%k) & (set th=%%l)
rem note the variable names for Time: hr, mn, sc, th
)))
if 1%yy% LSS 200 (set yy=20%yy%) & :: ensure 4-digit years in %yy%
if 1%hr% LSS 20 (set hr=0%hr%) & :: ensure 2-digit hours in %hr%
echo Date is: %yy%-%mm%-%dd% Time is: %hr%:%mn%:%sc%.%th%</pre>
Given my code, you ought to be able to modify yours, I would hope...
John
<font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>
Ita, esto, quidcumque...
John,
After a while most of the code looks similar. Although I would certainly would want to give credit to the individual who created it.
I am testing your code and am sure it will work with what I am trying to accomplish.
Many thanks, <img src=/S/bravo.gif border=0 alt=bravo width=16 height=30>
John