Forum Discussion

Santosh_Kumar's avatar
Santosh_Kumar
New Contributor
10 years ago
Solved

How to convert following string to a valid date format


Hi,



I have captured a date string in a jtree table and want to convert it to a standard date format so that i can compare it later to other standard dates.

I am not able to parse it as the captured string is not in a standard date format.

 

Code:

 dateEV = jjtree.getStringAt(1,3)

 log.Message("The date is :"&dateEV)

 log.Message(IsDate(dateEV))

 dateEV1 = aqConvert.StrToDateTime(dateEV)

 log.Message("The EVENT DATE is :"&dateEV1)



OutPut:

The date is :Mon Mar 03 11:00:00 IST 2014 

False 

VBScript runtime error. 

The test run has stopped because the "Stop on Error" setting is enabled.



Error:

The string cannot be parsed.



Screenshot from the application is attached.Screenshot



Please let us know if there is any alternative.



Thanks


3 Replies