Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for timeshift_php.bat

(view source code of timeshift_php.bat as plain text)

  1. @ECHO OFF
  2. IF NOT "%OS%"=="Windows_NT" GOTO Syntax
  3. IF      "%~2"==""           GOTO Syntax
  4. IF NOT  "%~6"==""           GOTO Syntax
  5. PHP -v   >NUL   2>&1   ||   GOTO Syntax
  6.  
  7. PHP -r "date_default_timezone_set('%~1'); print(date_format(new DateTime(date('c',strtotime('%~2 %~3 %~4 %~5'))),'d-m-Y H:i:s'));"
  8. EXIT /B 0
  9.  
  10.  
  11. :Syntax
  12. ECHO.
  13. ECHO TimeShift.bat,  Version 1.01 for Windows NT4+ and PHP 5.2+
  14. ECHO Convert date/time from any timezone to local date/time
  15. ECHO.
  16. ECHO Usage:    TIMESHIFT local_timezone remote_date remote_time remote_timezone
  17. ECHO.
  18. ECHO Example:  TIMESHIFT Europe/Amsterdam 2011-04-09 9:00 PM PDT
  19. ECHO.
  20. ECHO Returns:  10-04-2011 06:00:00 or 04/10/2011 06:00:00 (local time for Amsterdam)
  21. ECHO.
  22. ECHO Requires: PHP 5.2 or later
  23. ECHO.
  24. ECHO Written by Rob van der Woude
  25. ECHO http://www.robvanderwoude.com
  26.  
  27. IF "%OS%"=="Windows_NT" EXIT /B 1
  28.  

page last modified: 2024-04-16; loaded in 0.0053 seconds