time format am pm

March 6, 2012 at 08:06:17
Specs: Windows XP
hi i used this cpde %time%
i want show time with am or pm
plz help

See More: time format am pm

Report •

March 6, 2012 at 15:57:58
Heres a code bit I wrote like a year ago

set hours=%time:~0,2%
set min=%time:~3,2%
if %hours% GTR 12 (
set /a hours=hours-12
set ext=pm
) else (
set ext=am
set thetime=%hours%:%min% %ext%
goto :eof

use this code to set the variable "thetime" to the current time + am/pm

call :time
echo %thetime%

Report •
Related Solutions

Ask Question