Batch: Timestamp to UNIX Time

前端 未结 5 743
感情败类
感情败类 2020-12-16 16:44

For all I know, Batch does not have a command that gives the UNIX time. The closest one I can find is %time%, which only displays the timestamp.

Is ther

5条回答
  •  太阳男子
    2020-12-16 17:19

    By far best solution is to download a freestanding date.exe unix-port.

    Recommend that you rename it to unixdate.exe, to avoid conflict with MS Date command.

    Get it from here

    1. download & unzip. As far as I know, all the utilities are 'portable', that is, they don't require any installation program for them to work. I've only used a few (rm.exe & date.exe). Also, you can ReName the exe's in case they might match other system utils you already have
    2. Find the actual executable ports in the subfolder (usr\local\wbin)
    3. To get HELP info type the command followed with --help (must spell help in lowercase)

    Example:

    ((PROMPT)):unixdate +%Y%M%d
    20141704
    
    ((PROMPT)):unixdate +%Y%b%d
    2014Sep04
    

提交回复
热议问题