Micro Focus QTP (UFT) Forums
Date format changes from 'yyyy-mm-dd hh:mm:ss' to 'mm/dd/yyyy' - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Date format changes from 'yyyy-mm-dd hh:mm:ss' to 'mm/dd/yyyy' (/Thread-Date-format-changes-from-yyyy-mm-dd-hh-mm-ss-to-mm-dd-yyyy)



Date format changes from 'yyyy-mm-dd hh:mm:ss' to 'mm/dd/yyyy' - Rashmi Vishwanath - 01-08-2013

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


RE: Date format changes from 'yyyy-mm-dd hh:mm:ss' to 'mm/dd/yyyy' - Rashmi Vishwanath - 01-09-2013

Please any one guide me.. I am stucked up


RE: Date format changes from 'yyyy-mm-dd hh:mm:ss' to 'mm/dd/yyyy' - soumen - 01-10-2013

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.