Computing.Net > Forums > Programming > Problems with date command in W2003 Server

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Problems with date command in W2003 Server

Reply to Message Icon

Name: Lupita
Date: June 9, 2009 at 03:42:40 Pacific
OS: Windows 2003 Server
Subcategory: Batch
Comment:

I am working with SBS w2k3 Server Spanish version.
I need the day of week to do a msdos script.
if I put 'date /t' shows dd/mm/yyyy format, I don't need this. I need ddd, dd/mm/YYYY format. Can you help me, please??



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: June 9, 2009 at 03:52:01 Pacific
Reply:

control panel > regional > date


=====================================
If at first you don't succeed, you're about average.

M2


0

Response Number 2
Name: Lupita
Date: June 9, 2009 at 04:02:41 Pacific
Reply:

First, Excuse me for my English, it is very bad.
I know I can choose date format in Control Panel. But only shows dd/mm/yyyy format in ms-dos, I can not change it.
I try to explain me better.
I am doing a ms-dos script. When I put 'date /t' in command line only shows the format I say before, and I want the day of week. I will be crazy finding it.


0

Response Number 3
Name: ghostdog
Date: June 9, 2009 at 04:34:09 Pacific
Reply:

so you want the day of week in alphabets, eg Tue, or Wed right?


0

Response Number 4
Name: Lupita
Date: June 9, 2009 at 04:41:28 Pacific
Reply:

Right! I don't mind if it is in English or Spanish, but I need to Know if it is Sun, Mon.. or Friday. And I don't mind if it shows only with 3 caracters o completly.
Do you understand me?


0

Response Number 5
Name: ghostdog
Date: June 9, 2009 at 04:54:28 Pacific
Reply:

better to do it with something else, eg vbscript

WScript.Echo WeekdayName(Weekday(Now),1)


0

Related Posts

See More



Response Number 6
Name: Lupita
Date: June 9, 2009 at 04:59:38 Pacific
Reply:

ok.

Thanks a lot.


0

Response Number 7
Name: David Perry
Date: June 9, 2009 at 07:16:34 Pacific
Reply:

SETLOCAL ENABLEEXTENSIONS

FOR /F "tokens=1,2 delims= " %%A in ('ECHO %DATE%') DO (
set FULLDATE=%%B
set DOW=%%A
)

if "%FULLDATE%"=="" (
goto GB
) else (
goto US
)

:US
For /f "tokens=1-7 delims=:/-, " %%i in ('echo exit^|cmd /q /k"prompt $D $T"') do (
For /f "tokens=2-4 delims=/-,() skip=1" %%a in ('echo.^|date') do (
set dow=%%i
set %%a=%%j
set %%b=%%k
set %%c=%%l
set hh=%%m
set min=%%n
set ss=%%o
)
)

goto end

:GB
For /f "tokens=1-6 delims=:/-, " %%i in ('echo exit^|cmd /q /k"prompt $D $T"') do (
For /f "tokens=2-4 delims=/-,() skip=1" %%a in ('echo.^|date') do (
set %%a=%%i
set %%b=%%j
set %%c=%%k
set hh=%%l
set min=%%m
set ss=%%n
)
)


0

Response Number 8
Name: Lupita
Date: June 9, 2009 at 23:57:35 Pacific
Reply:

thanks David. But I need de day of week, not de number of the day of the month.
The comand date takes de output: dd/mm/yyyy. And I would Know if today is Wensday or Friday, or Saturday.

Don't mind. I ask to my boss.


0

Response Number 9
Name: Mechanix2Go
Date: June 10, 2009 at 05:46:37 Pacific
Reply:

This will get the day of the week from BIOS, regardless of language, region or anything else.

==============================
@echo off > d.d

>> d.d echo E 0100 B4 2A CD 21 B4 4C CD 21
>> d.d echo N getdow.COM
>> d.d echo RCX
>> d.d echo 8
>> d.d echo W
>> d.d echo Q

debug < d.d > nul
del d.d

getdow
if errorlevel 0 set day=Sunday
if errorlevel 1 set day=Monday
if errorlevel 2 set day=Tuesday
if errorlevel 3 set day=Wednesday
if errorlevel 4 set day=Thursday
if errorlevel 5 set day=Friday
if errorlevel 6 set day=Saturday
echo today is %day%
del getdow.com


=====================================
If at first you don't succeed, you're about average.

M2


0

Response Number 10
Name: David Perry
Date: June 10, 2009 at 05:53:46 Pacific
Reply:

Day of week is available in some locales and not other. You can set your locale through the control panel. Have a look at the variable %dow% that is getting set in the US section.

%dow% day of the week ie Wed
%mm% month
%dd% day of the month
%yy% 4 digit year
%hh% hour
%min% minute
%sec% second



0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Problems with date command in W2003 Server

problem with date() function in PHP www.computing.net/answers/programming/problem-with-date-function-in-php/8855.html

vb shell command in win 2000 www.computing.net/answers/programming/vb-shell-command-in-win-2000/5429.html

problem with VB6 package in Win2000 www.computing.net/answers/programming/problem-with-vb6-package-in-win2000/2977.html