HOW to find last SUNDAY DATE through batch

大憨熊 提交于 2020-01-15 08:03:46

问题


How to find 'last SUNDAY DATE' through batch command? what I was trying is

echo %date:~4,2%%date:~7,2%%date:~10,4%

this is good for current date but for last Sunday date... can anyone suggest any logic through batch.


回答1:


Windows PowerShell:

[DateTime]::Now.AddDays(-1 * [DateTime]::Now.DayOfWeek.value__)

Sorry the environment variable %date% in Batch (.bat) files sounds uneasy to do calculations.



来源:https://stackoverflow.com/questions/33773683/how-to-find-last-sunday-date-through-batch

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!