Advertisement
npocmaka

w32timeParts

May 9th, 2013
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off
  2. rem -- get time/date parts using w32tm
  3. rem -- by Vasil "npocmaka" Arnaudov
  4. echo\
  5. for /F "eol=C tokens=1,2,3,4,5,6,7 delims=Tabcdefghijklmnopqrstuvwxyz/:. " %%a in ('w32tm /stripchart /computer:localhost  /samples:1  /period:1') do (
  6.  
  7.     if "%%g" neq "" (
  8.         echo year:     %%c
  9.         echo month:    %%b
  10.         echo day:      %%a
  11.         echo\
  12.         echo hour:     %%d
  13.         echo am/pm:    %%g
  14.         echo minutes:  %%e
  15.         echo seconds:  %%f
  16.        
  17.         set "year=%%c"
  18.         set "month=%%b"
  19.         set "day=%%a"
  20.         if "%%g" equ "AM" set  "hour=%%d"
  21.         if "%%g" equ "PM" set /a "hour=12+%%d"
  22.         set "miutes=%%e"
  23.         set "seconds=%%f"    
  24.     )
  25. )
  26. echo\
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement