DOS - STRIP THE LAST 3 CHARACTERS FROM %TIME%

this probably isn't very difficult, but I dont know how to do it.  I have a batch file that runs, and it uses the %time%

the problem, is that this returns for example 14:23:36.32

My program doesn't handle the .32 at the end well, and so I need to remove it.  How can I strip those last 3 characters?

Thanks,
LVL 6
wirthrAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

InteractiveMindCommented:
set edited_time=%time:~0,-3%

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
wirthrAuthor Commented:
worked like a charm, thanks.
InteractiveMindCommented:
To extract data from a variable in DOS.
=========================

The command to extract the necessary data from a variable takes the following form:

   %variable:~i,k%

Where 'i' is the index of the starting character of the substring (where 0 is the very first), and 'k' is the index of the last character +1, of your substring.

You can specify the index of the characters to be measured relative to the right-hand-side of the variable, by shoving a minus character (hypen -) in front of the number.

  14:23:36.32
 ^           ^
  0           -3

Hence:

   %time:~0,-3%

Note, that if both of the indices are set to be measured relative to the same side, then 'k' is measured relative to 'i'.



Thanks for points :)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.