Question

How do I can change the output format of echo %date% in command prompt? In one system I receive the output as Wed 02/12/2014 but in another system I receive the output as 02/12/2014. Command I am typing on both the systems is echo %date%.

What I basically need to find out is Day of Week. So if can’t change the format then is there any other command in the command-line to get the Day of week?

Was it helpful?

Solution

This solution was posted recently and should work the same on any PC after XP Home.

@echo off  
set "daysofweek=Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday"  
for /F "skip=2 tokens=2 delims=," %%a in ('wmic Path Win32_LocalTime Get DayOfWeek /Format:csv') do set "daynumber=%%a"
for /F "tokens=%daynumber% delims=," %%b in ("%daysofweek%") do set "dow=%%b"
echo "%dow%", "%daynumber%"
pause
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top