Last active
          May 30, 2018 12:34 
        
      - 
      
- 
        Save joshschmelzle/af52ef66da8c03022504a7540c1bd32f to your computer and use it in GitHub Desktop. 
    Prints the local date and time in ISO format to the screen on a Windows machine
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | @echo off | |
| for /F "usebackq tokens=1,2 delims==" %%i in (`wmic os get LocalDateTime /VALUE 2^>NUL`) do if '.%%i.'=='.LocalDateTime.' set ldt=%%j | |
| set ldt=%ldt:~0,4%-%ldt:~4,2%-%ldt:~6,2% %ldt:~8,2%:%ldt:~10,2%:%ldt:~12,6% | |
| echo local time is %ldt% | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment