dear all,
i hava a date format in excel file like 2020/3/19 , how could i change the date format to 20200319?
anybody could give me some guide ? thanks a lot in advance.
dear all,
i hava a date format in excel file like 2020/3/19 , how could i change the date format to 20200319?
anybody could give me some guide ? thanks a lot in advance.
Can you try by replacing the ‘/’ by ‘’ inside a for each row?
Or
By using Linq .
Can you try by replacing the ‘/’ by ‘’ inside a for each row? could u give me some demo?
You can use below code, @chrisjiyiwei
Datetime.parseexact( 2020/3/19,“yyyy/M/dd”,system.globalization.cultureinfo.invariantculture).ToString(“yyyyMMdd”)
use this way, the result is 03192020 00:00:00 how to solve it?
how to use this way? could u give me some demo?
@chrisjiyiwei: You can simply use the following line of code: (Replace string with string variable)
Convert.ToDateTime(“2020/3/19”).ToString(“ddMMyyyy”)
Cheers
@Priyanka_Ramesh @chrisjiyiwei @Manish540 @Mohsin_Inamdar @Bhavik_Solanki
how to convert date in the format “DD-MMM-YY” OR “DD-MMM-YY” TO DD/MM/YYYY ?
example 26 March 21 to 26/03/2021 or 19 Feb 2021 to 19/02/2021
Hi @Sakshi_Jain,
Make an array of strings for the formats you will get
for example
String[] array_DateFormats = { “dd-MMMM-yy”, “dd-MMM-yy”};
then
str_OutputDate=DateTime.ParseExact(here_your_date.ToString(),array_DateFormats ,Globalization.CultureInfo.InvariantCulture).ToString(“dd/MM/yyyy”)