troubleshooting Question

VB.NET parse datetime string to get just time

Avatar of NursingCorp
NursingCorpFlag for United States of America asked on
Visual Basic ClassicVisual Basic.NETEditors IDEs
4 Comments1 Solution4811 ViewsLast Modified:
Assistance getting a value out of a datetime string using VB.NET,

We start with a string for the startTime = 1/8/2009 5:30:00 AM

How do I  parse this string to get the hour of the time (i.e. 5)
then, parse the string to get the minutes (i.e. 30)
then, parse the string to get the AM/PM part

and then convert it based on,
 
if the minutes = 00, set the newStartTime = 5.0
if the minutes = 30 set the newStartTime = 5.5
if the AM/PM were PM, then add 12 to hours so that newStartTime = 17.5

I am new to computer programming, and have been trying to learn via books and online videos.

Thanks,
Joe


Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros