Computing.Net > Forums > Disk Operating System > re-formatting date & time

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.

re-formatting date & time

Reply to Message Icon

Name: rohaza
Date: July 21, 2002 at 21:30:14 Pacific
Comment:

Need help on this matter.

I have INPUT file contains unformatting date & time as below:
020717001200

What i want is to format this date & time to by inserting '/' and ':' to another OUTPUT file and the data will be like this:

17/07/0200:12:00

Please..soebody help me.

Thanks in advance
rohaza



Sponsored Link
Ads by Google

Response Number 1
Name: Secret_Doom
Date: July 31, 2002 at 11:47:29 Pacific
Reply:

In Win9x, this should do it:

===== BATCH SCRIPT BEGIN =====
@echo off
if "%1"=="GoTo:" %1%2
echo e100'SET %%1='> %TEMP%.\T.BAT
for %%? in (rcx 7 w q) do echo %%?>> %TEMP%.\T.BAT
type %TEMP%.\T.BAT |DEBUG %TEMP%.\T.BAT > nul

:: Set INPUT file below (you might use %1)
type INPUT.EXT>> %TEMP%.\T.BAT

call %TEMP%.\T.BAT VAR
echo ; |CHOICE /c;%VAR%; call %0 GoTo: parse;> %TEMP%.\T.BAT
for %%? in (call del) do %%? %TEMP%.\T.BAT

:: Set OUTPUT file below (you might use %2)
echo %VAR%> OUTPUT.EXT

set VAR=
goto eof
:parse
for %%? in (1 2 3) do SHIFT
set VAR=%5%6/%3%4/%1%2%7%8
for %%? in (1 2 3) do SHIFT
set VAR=%VAR%:%6%7:%8%9
:eof
===== BATCH SCRIPT END =====

Watch out for line wrapping!

Read commented lines. Just for making things clear: if the INPUT file contains:

0123456789ABC

The OUTPUT file will contain:

56/34/1278:9A:BC

-- Leonardo Pignataro - Secret_Doom --

secret_doom@hotmail.com
www.batch.hpg.com.br


0
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: re-formatting date & time

Batch files date and time www.computing.net/answers/dos/batch-files-date-and-time/10101.html

%DATE% and %TIME% in Windows NT? www.computing.net/answers/dos/date-and-time-in-windows-nt/12957.html

Create file with date and time www.computing.net/answers/dos/create-file-with-date-and-time/13843.html