Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Date format changes from 'yyyy-mm-dd hh:mm:ss' to 'mm/dd/yyyy'
#1
Not Solved
HI Smile,
Any one let me know while fetching date feild from datatable in QTP its taking as "mm/dd/yyyy h:mm" format even though in datatable its displaying as "mm/dd/yyyy h:mm:ss AM" by the time of running it takes as "mm/dd/yyyy h:mm"

Code:
rows=browser("").Page("").WebTable("").RowCount
For j=0 to rows
var=Browser("").Page("").WebTable("").GetCellData(j,1)
var2=dataTable("Col1",dtlocalsheet)
If var=var2 Then
fromdate=Browser("").Page("").WebTable("").GetCellData(j,2)
frmTabledate=datatable("FromDate",dtlocalsheet)
if fromdate=frmTabledate then
Reporter.reportevent Micpass. "Success". "Added"
End if
End if
Next

Here for frmTabledate its taking as mm/dd/yyyy h:mm where fromdate is in "mm/dd/yyyy h:mm:ss AM" format hence not going inside loop.

Please some one help me out as i am a fresher
Reply
#2
Not Solved
Please any one guide me.. I am stucked up
Reply
#3
Not Solved
While inserting the date in the datatable column start with an single quote (e.g: '1/13/2012 5:29:35 AM). This will store the date as a string format in the datatable. While retrieving the value from the datatable you will get it as a string. Then you can use it for your comparison as required.
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 3,907 05-30-2014, 01:25 PM
Last Post: Tarik Sheth
  Validate Numeric value is displaying expected format kalaivanan123 1 3,385 09-23-2013, 08:45 PM
Last Post: ravi.gajul
  How to identify the sap date format. kamal262007 4 3,537 10-17-2012, 08:25 AM
Last Post: kamal262007
  Need Help Datatable Parameterzing Date debindas 1 3,420 08-30-2012, 11:43 PM
Last Post: QTPScript
  How To Select Date From a Calender Image Where Date field is non editable? RameshKrishnan 1 3,840 05-28-2012, 09:29 PM
Last Post: defcon3

Forum Jump:


Users browsing this thread: 1 Guest(s)