Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Date Format change
#1
Solved: 10 Years, 9 Months, 1 Week ago
I am trying to change the DateRequested from 2/27/2012 to 02-27-2012

my code is as such:

Code:
DateRequested = FormatDateTime(Date, 2)
Call DateManipulate(DateRequested)  'Insure date is MM/DD/YYYY format
year = Right(MM/DD/YYYY, 4)
month = left(MM/DD/YYYY, 2)
day = left(right(MM/DD/YYYY, 7), 2)
DateRequested = month & "-" & day & "-" & year

Public Function DateManipulate(eDate)

'Insure date is MM/DD/YYYY format
    Set MyDate = DotNetFactory.CreateInstance("System.DateTime")
    Set oDate = MyDate.Parse(eDate)
    DateManipulate = oDate.ToString("MM/dd/yyyy")
    eDate = DateManipulate
    'msgbox DateManipulate
    Set MyDate = Nothing

End Function


i am getting a Run Error: Overflow

What must i change? My date is returned as "02/27/2012"

(I found this code on the web and updated it with my values.)
Reply


Messages In This Thread
Date Format change - by mv8167 - 02-28-2012, 03:40 AM
RE: Date Format change - by inborntester - 02-28-2012, 07:38 AM
RE: Date Format change - by mv8167 - 02-28-2012, 10:34 PM
RE: Date Format change - by inborntester - 02-29-2012, 12:01 AM
RE: Date Format change - by sshukla12 - 03-02-2012, 03:10 PM
RE: Date Format change - by mv8167 - 03-02-2012, 07:09 PM
RE: Date Format change - by sshukla12 - 03-05-2012, 10:03 AM
RE: Date Format change - by Saajo87 - 03-05-2012, 11:04 AM
RE: Date Format change - by mv8167 - 03-05-2012, 07:11 PM
RE: Date Format change - by SteveS - 03-05-2012, 08:54 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How do you Change Run mode mid script? Caleytown 6 6,548 03-25-2021, 08:27 AM
Last Post: RB26578
  [UFT] Change property of object (WpfButton) robertosalemi 2 2,495 11-22-2016, 12:43 PM
Last Post: Ankur
  Dynamic change of name for Webtables prakashreddy 1 2,282 10-25-2014, 09:53 PM
Last Post: supputuri
  How can I change my test folders, globally? atester 0 1,889 10-03-2014, 04:37 PM
Last Post: atester
  QTP11.0 - Date format is changed as text while executing the QTP script. Automation Tester 1 3,913 05-30-2014, 01:25 PM
Last Post: Tarik Sheth

Forum Jump:


Users browsing this thread: 1 Guest(s)