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

re-formatting date & time

Reply to Message Icon

Original Message
Name: rohaza
Date: July 21, 2002 at 21:30:14 Pacific
Subject: re-formatting date & time
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


Report Offensive Message For Removal


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

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


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: re-formatting date & time

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




Have you ever used OpenOffice?

Yes, as my main suite.
Yes, occationally.
Yes, but only once.
No, never.


View Results

Poll Finishes In 3 Days.
Discuss in The Lounge