Datascrap column datatype conversion

Hi Guys,

I am trying to data scrap table to excel but i want to filter out date column present in datascrap datatable before exporting to excel. i tried using filter data table with datatime.now.tostring(yyyy-MM-dd HH:mm) i.e. i want records which are less than current date. but when i tried this i am not getting any result. i think this might be due to compare operator not working. Can i know if we can change column i…e “column-5” present in datascrap datatable to date datatype format?

or any other solution to get my data?

If I understood you right, what you would like to do is just to retain data that is less than the current data.
What you can do is to do a for each row in your datatable and remove the rows that are equal to the current date. After that you can write range your final datatable to excel

Hi ,

i above scenario i said is just a sample like less than current date but i may need records with greater than a particular date i.e. Datetime.now.adddays(-20) or vice versa…but issue i am facing is when i do data scrap from a webpage by default all the columns system is fetching using datascarp are in string format … due to this when i use < or > opeartors i am unable to do any operation on date format column because they are in string. …so my i hope is my issue can be resolved if i convert that datatype of string to datetime datatype when i fetch dataa using datascrap…

Okay. What you can do is get each “column” of the string scraped from website. When you scraped it from a website I am guessing what you will have is a long piece of string separated by “space” and “linebreaks”. You can get each line and take each piece of string that you need and assign it to variable. For example on the part where you have the date and time you assign it first to string strDateTime. Then use Convert.ToDateTime(strDateTime)