--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
最后
以上就是从容中心最近收集整理的关于日期格式改为字符串形式的全部内容,更多相关日期格式改为字符串形式内容请搜索靠谱客的其他文章。
发表评论 取消回复