Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to change 24 hrs time format to 12 hrs time format
#1
Solved: 6 Years, 1 Week ago
Hi All, 

I would like to convert following 24 hrs time to 12 hrs format using UFT 12.5.

Time: 1430

expected to show as: 2:30

Please do the needful.

Thank you.
Reply
#2
Solved: 6 Years, 1 Week 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


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,589 01-17-2017, 11:05 AM
Last Post: JACKSPARROW
  Load Add-in at execution time driverdash 0 2,061 08-11-2015, 12:35 AM
Last Post: driverdash
  HI, i'm having a run time error ,please help? Awzar 0 2,389 01-24-2015, 06:52 AM
Last Post: Awzar
  How to validate a format of an alphanumeric string PrateepKaraval 2 5,784 11-08-2014, 10:26 AM
Last Post: vinod123
  Loading objects in qtp at run time nitin 0 2,303 12-03-2013, 09:11 PM
Last Post: nitin

Forum Jump:


Users browsing this thread: 1 Guest(s)