Skip to content

Instantly share code, notes, and snippets.

@asmwarrior
Forked from cjwinchester/get_date
Created October 12, 2023 14:58
Show Gist options
  • Save asmwarrior/a8e84c4a78ce3a6c01fdbefebc7da8b3 to your computer and use it in GitHub Desktop.
Save asmwarrior/a8e84c4a78ce3a6c01fdbefebc7da8b3 to your computer and use it in GitHub Desktop.

Revisions

  1. @cjwinchester cjwinchester created this gist Apr 9, 2015.
    8 changes: 8 additions & 0 deletions get_date
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    :: adapted from http://stackoverflow.com/a/10945887/1810071
    @echo off
    for /f "skip=1" %%x in ('wmic os get localdatetime') do if not defined MyDate set MyDate=%%x
    for /f %%x in ('wmic path win32_localtime get /format:list ^| findstr "="') do set %%x
    set fmonth=00%Month%
    set fday=00%Day%
    set today=%Year%-%fmonth:~-2%-%fday:~-2%
    echo %today%