Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to change 24 hrs time format to 12 hrs time format
#2
Solved: 6 Years, 3 Weeks ago
It can be done using several ways by using custom functions or built in functions in VB Script.

If the time is always in this format hhmm, you just need to introduce a colon : between hh & mm and pass the result to TimeValue built in function.

Here is how:


Code:
Dim t24hr, t12hr

t24hr = "1430"
t24hr = Replace(t24hr, Right(t24hr,2), ":" & Right(t24hr,2))

t12hr = TimeValue(t24hr)

msgbox t12hr
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply


Messages In This Thread
RE: How to change 24 hrs time format to 12 hrs time format - by Ankur - 04-21-2018, 11:06 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Trying to create List box in excel sheet at Run time with values yes No JACKSPARROW 0 1,597 01-17-2017, 11:05 AM
Last Post: JACKSPARROW
  Load Add-in at execution time driverdash 0 2,070 08-11-2015, 12:35 AM
Last Post: driverdash
  HI, i'm having a run time error ,please help? Awzar 0 2,397 01-24-2015, 06:52 AM
Last Post: Awzar
  How to validate a format of an alphanumeric string PrateepKaraval 2 5,810 11-08-2014, 10:26 AM
Last Post: vinod123
  Loading objects in qtp at run time nitin 0 2,312 12-03-2013, 09:11 PM
Last Post: nitin

Forum Jump:


Users browsing this thread: 1 Guest(s)