Date format change on other server

Hewlett-packard / Compaq nc8230
November 3, 2009 at 14:00:08
Specs: Windows XP, 1 GB
Hi,

I am facing some problem with Date and i don't know why.
I have script which is on P drive where date is '03/11/2009' and my machine date format is 'Tue 03/11/2009' . When I run script which is on P drive it takes Date format which is on my machine.

first of all why? how can make script on P drive flexible so who ever run it it will take date format from P drive.

Thanks in advance.


See More: Date format change on other server

Report •


#1
November 3, 2009 at 14:26:35
P is a mapped drive so it is as if on your computer. I think you need //machine/share instead. Might pm nails or other script person to be sure. I think mechanix2go is good to and others.

If not repost in coding maybe.

Playing to the angels
Les Paul (1915-2009)


Report •

#2
November 3, 2009 at 14:32:47
P is mapped drive to server which is other machine.

My all script are at P drive and just i am accessing those script from my machine and run those but those script pickup date format from my machine.

I want to force date from of P drive so that anyone will run that script from their machine will not face date format issue.


Report •

#3
November 4, 2009 at 14:00:28
Following code will cut the date in day , month and year. It handle date in US and UK date format.


@echo off&SETLOCAL

:: This will return date into environment vars
:: Works on any NT/2K/XP machine independent of regional date settings
:: 20 March 2002

FOR /f "tokens=1-4 delims=/-. " %%G IN ('date /t') DO (call :s_fixdate %%G %%H %%I %%J)
goto :s_print_the_date

:s_fixdate
if "%1:~0,1%" GTR "9" shift
FOR /f "skip=1 tokens=2-4 delims=(-)" %%G IN ('echo.^|date') DO (
set %%G=%1&set %%H=%2&set %%I=%3)
goto :eof

:s_print_the_date
echo Month:[%mm%] Day:[%dd%] Year:[%yy%]
ENDLOCAL&SET mm=%mm%&SET dd=%dd%&SET yy=%yy%

The useful bit there is the (dd-mm-yy), on a machine with different regional settings it may appear as (mm-dd-yy)

The first FOR command returns the 3 numeric parts of the date e.g. 14 04 2000
The second FOR command returns the 3 text descriptions e.g. dd mm yy
Then the line set %%G=%1&set %%H=%2&set %%I=%3 creates the 3 variables and sets them = numeric values

Effectively: set dd=14&set mm=04&set yy=2000
On a machine with different regional settings this might become: set mm=04&set dd=14&set yy=2000


Report •

Related Solutions


Ask Question