Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Returned Date Format
#1
Solved: 11 Years, 3 Months, 1 Week ago
I have the following code:

Code:
eDate = DateAdd("d",-1,Now())
eDate = FormatDateTime(eDate,2)

which returns the value 6/29/2011

but I need the zero in front of the six. I need 06/29/2011 returned.

Any ideas is this is possible?

thx for looking.
Reply
#2
Solved: 11 Years, 3 Months, 1 Week ago
Code:
eDate = DateAdd("d",-1,Date)

If len(month(eDate))=1 then
eDate=0&eDate
end if[hr]
Reply
#3
Solved: 11 Years, 3 Months, 1 Week ago
Rajpes,

Thx again...

Your solution is way easier then my final solution:

Code:
TodayDateMinusOne = DateAdd("d",-1,Now())
    eDate = FormatDateTime(TodayDateMinusOne, 2)
    'Call DateManipulate(eDate)  Insure date is MM/DD/YYYY format

    '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



lol
Reply
#4
Solved: 11 Years, 3 Months, 1 Week ago
ya, you don't need to complicate so much, just use simple logic
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  QTP11.0 - Date format is changed as text while executing the QTP script. Automation Tester 1 4,093 05-30-2014, 01:25 PM
Last Post: Tarik Sheth
  Validate Numeric value is displaying expected format kalaivanan123 1 3,490 09-23-2013, 08:45 PM
Last Post: ravi.gajul
  Date format changes from 'yyyy-mm-dd hh:mm:ss' to 'mm/dd/yyyy' Rashmi Vishwanath 2 5,091 01-10-2013, 10:10 AM
Last Post: soumen
  How to identify the sap date format. kamal262007 4 3,707 10-17-2012, 08:25 AM
Last Post: kamal262007
  Need Help Datatable Parameterzing Date debindas 1 3,655 08-30-2012, 11:43 PM
Last Post: QTPScript

Forum Jump:


Users browsing this thread: 1 Guest(s)