Date referenced in Windows batch file

Source: Internet
Author: User

See also: http://blog.csdn.net/iw1210/article/details/39313677

%date% Output: Yyyy/mm/dd week * (for example: 2008/12/18 Thursday)
Reference format:%date:~x,y%
x= start coordinates, y= the number of characters from X

Such as:
%date:~0,4%-yyyy
%date:~5,2%--mm
%date:~8,2% to DD

If you remove the date formatted as YYYYMMDD:%date:~0,4%%date:~5,2%%date:~8,2%-->20081218

%time% output is: hh24:mi:ss.ms (ex: 10:49:12.17)
Reference format:%time:~x,y%
x= start coordinates, y= the number of characters from X

Such as:
%time:~0,2% to HH
%time:~3,2%-MI
%time:~6,2%--SS

If the time of the format HHMMSS is removed:%time:~0,2%%time:~3,2%%time:~6,2%-->104912

Date time after format of output:%date:~4,4%%date:~9,2%%date:~12,2%%time:~0,2%%time:~3,2%%time:~6,2%-->20081218104912

Date referenced in Windows batch file

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.