Convert Date format while writing in Excel or Data Table

I have a report generated with this Date format:


When I write this data in another excel/data table, I want the date format like this:
image
Any suggestions will be appreciated. Thanks

@Rachita_Chauhan - You can try DateimeParseExact…

DateTime.ParseExact(row("InvoiceDate").ToString.Trim,"yyyy-MM-dd HH:mm:ss",System.Globalization.CultureInfo.InvariantCulture).ToString(“M/d/yyyy”)

OR

DateTime.ParseExact(row("InvoiceDate").ToString.Trim,"yyyy-MM-dd",System.Globalization.CultureInfo.InvariantCulture).ToString(“M/d/yyyy”)
1 Like

So, I have one more question, if I need to check that the Date is in yyyy-MM-dd format, how will I do that? Thanks…

@Rachita_Chauhan - I guess you are looking for this…

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.