benmyers
(Benmyers)
1
Hi,
I am scraping invoices and need to format the dates. Dates could be in any format such as below
28/10/20
28-10-20
2020-10-28
28.10.2021
etc…
I have tried the below assign code and many others just cant seem to find something that will work 100%
Assign: String was not recognized as a valid DateTime.
strparsedate = DateTime.ParseExact(dataSetResults.Tables(0).Rows(0).Item("InvoiceDate".ToString).ToString, “dd/MM/yyyy”,System.Globalization.DateTimeFormatInfo.InvariantInfo)
Hi
Did this thread help you resolve this
Cheers @benmyers
benmyers
(Benmyers)
3
do you have an xaml of this. I keep getting errors
lakshman
(Ganta lakshman)
4
@benmyers
May I know in what format you want to change the date ?
lakshman
(Ganta lakshman)
6
@benmyers
Try this.
CDate("yourDateTimeVar").ToString("yyyyMMdd")
benmyers
(Benmyers)
7
I had tried that but I didnt have the date set as date format in the taxonomy.
Its now working.
Thanks,
ppr
(Peter Preuss)
8
Have a look here:
DateTime.ParseExact(strDate1,Formats,CultureInfo.InvariantCulture,DateTimeStyles.None)
here we do handle different dateformats in one ParseExact
benmyers
(Benmyers)
9
I have tied this. Still getting the same error.
strparsedate = DateTime.ParseExact(dataSetResults.Tables(0).Rows(0).Item("InvoiceDate".ToString).ToString,dateformat,CultureInfo.InvariantCulture,DateTimeStyles.None)
system
(system)
Closed
10
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.