Benutzer-Werkzeuge

Webseiten-Werkzeuge


dos:timestamp

timestamp

Für Deutsche oder Englisches Datumsformat ein timestamp erstellen YYYYMMDDHHMMSSHH

timestamp.cmd
@echo off
 
 
:MAIN
  call :create_timestamp
  echo Timestamp: %TIMESTAMP%
  pause
goto END

 
::functions
:create_timestamp
  setlocal
  if "%date:~-5,1%" == "." (
    REM read german date format DDDD DD.MM.YYYY
    set _date_YYYYMMDD=%date:~-4,4%%date:~-7,2%%date:~-10,2%
  ) else (
    REM read english date format DDDD MM/DD/YYYY
    set _date_YYYYMMDD=%date:~-4,4%%date:~-10,2%%date:~-7,2%
  )
  set _now=%time%
  set _hour=%_now:~0,2% 
  if "# #"=="#%_now:~0,1%#" set _hour=0%_now:~1,1%
  set _time_HHMMSShh=%_hour%%_now:~3,2%%_now:~6,2%%_now:~-2,2%
  set _timestamp=%_date_YYYYMMDD%%_time_HHMMSShh%
  endlocal & set TIMESTAMP=%_timestamp%
  exit /b
 
:END
  exit 0
 
dos/timestamp.txt · Zuletzt geändert: 2014/02/12 02:13 von Admin