Taking the hour from: now=TimeYmdHms()
xhour= ItemExtract(4,now,":")
xmin= ItemExtract(5,now,":")
I need to convert the time from 24h format to 12h format.
Any help will be much appreciated ....
The simplest way is to use the TimeFormat function. More information on the function can be found in the Consolidated WIL Help file. If your version is too old to have that function then it is a matter of a little arithmetic:
From the Tech Database article http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/UDF~-~UDS~Library/Time~UDFs+Format~Current~Date~and~Time.txt (http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/UDF~-~UDS~Library/Time~UDFs+Format~Current~Date~and~Time.txt)
if Hour24 < 12
Hour12 = Hour24 ; Get 12-hour format hour
AMPM = "am" ; and AM/PM value
else
Hour12 = Hour24 - 12
AMPM = "pm"
endif
if Hour12 == 0 then Hour12 = 12