Data scrapping date

when i scrap date from site that contain both single figure for month and day then it will swap.

For example, when i scrap 08/03/2017 (dd/mm/yyyy) from site and extract as a datatable and write to excel it will become 03/08/2017 (mm/dd/yyyy).

For the rest of the dates that contain either day or month with double figure, it will remain the same.
For example, when i scrap 31/05/2011 (dd/mm/yyyy) from site and extract as a datatable and write to excel it will become 31/05/2011 (mm/dd/yyyy).

When you scrap the data I guess the date value is in string format.
Please fix the data table column data type or set the format of excel column where you are entering the date.

you can also try by parsing a date.
For example use : System.DateTime.Parse(“DateToParse”)
Hope this works.

the arrangement of the figure already wrong when it extracted out.
on the site:08/03/2017 8th march 2017 in excel:03/08/2017 3rd August 2017-> so therefore i couldn’t format beforehand

“date” cannot be converted to “system.data.datatable”.
in the datatable there are also other information other than date.

Hi @jackyWHJ ,

Your excel application may use the local Date-time format. You can change the date format in excel by, Select the date cells → Press Ctrl+1 or go to Format Cells → Under ‘Number’ tab, select Date and choose the required date format.

Warm regards,
Nimin

Hi
Only single date then Will swap
8/1/2018 8 Jan -after scrap- 1/8/2018 1 aug

As long there is a double digit day or month it won’t change
17/10/2018 17 oct -after scrap- 17/10/2018 17 oct
8/10/2018 8 oct - after scrap- 8/10/2018 8 oct
17/8/2018 17 aug - after scrap- 17/8/2018 17 aug