Computing.Net > Forums > Windows XP > Date format change on other 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.

Date format change on other server

Reply to Message Icon

Name: hrshelke
Date: November 3, 2009 at 14:00:08 Pacific
OS: Windows XP
CPU/Ram: 1 GB
Product: Hewlett-packard / Compaq nc8230
Subcategory: General
Comment:

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.



Sponsored Link
Ads by Google

Response Number 1
Name: jefro
Date: November 3, 2009 at 14:26:35 Pacific
Reply:

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)


0

Response Number 2
Name: hrshelke
Date: November 3, 2009 at 14:32:47 Pacific
Reply:

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.


0

Response Number 3
Name: hrshelke
Date: November 4, 2009 at 14:00:28 Pacific
Reply:

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


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More






Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: Date format change on other server

Registry Date Format Change www.computing.net/answers/windows-xp/registry-date-format-change/132720.html

Change Date Format with a switch www.computing.net/answers/windows-xp/change-date-format-with-a-switch/170054.html

FAT32 Drives work on other machines www.computing.net/answers/windows-xp/fat32-drives-work-on-other-machines/163835.html