概述
--today.vbs--
today=Year(Date()) & Right("0" & Month(Date()),2) & Right("0" & Day(Date()),2)
wscript.echo today
--yesterday.vbs--
yesterday=DateAdd("d",-1,date)
yesterday_=Year(yesterday) & Right("0" & Month(yesterday),2) & Right("0" & Day(yesterday),2)
wscript.echo yesterday_
D:>cscript /nologo yesterday.vbs
20101020
--test.bat--
@echo off
for /f %%i in ('cscript /nologo today.vbs') do set TODAY=%%i
rem there blank space at "today" string,i don't konw why.
set JINTIAN=%TODAY: =%
echo 今天日期是:%JINTIAN%
for /f %%i in ('cscript /nologo yesterday.vbs') do set YESTERDAY=%%i
set ZUOTIAN=%YESTERDAY: =%
echo 昨天日期是:%ZUOTIAN%
D:>TEST.BAT
今天日期是:20101021
昨天日期是:20101020
转载于:https://www.cnblogs.com/abenz/archive/2010/10/21/1857510.html
最后
以上就是从容中心为你收集整理的日期格式改为字符串形式的全部内容,希望文章能够帮你解决日期格式改为字符串形式所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复