how to convert time in 24 hours format

Unitech Pt630d mobile computer, batch, 1...
June 22, 2010 at 03:28:23
Specs: Windows XP, 2gb
Hi people..
I wanted to ask if anyone can help me.I'm new in Batch and really hope that someone can guide me..

i wanted my program to read the variable for time in input file and automatically output the time in 24 hours format.

assume my input file = input.txt

the input in the input.txt :

SI_CREATION_TIME 6-27-08 3-20-23 AM

the desired output = 15-20-23

below are my script to read the time:

SET file_time=!file_date:~8,8!

FOR /F "tokens=1-3 delims=-" %%g IN ("!file_time!") DO (

SET file_hour=0%%g
SET file_hour=!file_hour:~-2!

SET file_min=0%%h
SET file_min=!file_min:~-2!

SET file_sec=0%%i
SET file_sec=!file_sec:~-2!

IF "%%q" EQU "PM"
SET file_x=%%m
SET file_x=!file_hour+:12!


SET combine_time=!file_x!-!file_min!-!file_sec! (output).. but the script is not correct..

Guide me pls..

See More: how to convert time in 24 hours format

Report •

June 22, 2010 at 06:33:04
When doing math in Windows batch, you need to use SET /A.

Insomniac at large

Report •
Related Solutions

Ask Question