Date Conversion format mismatch

  • Thread starter Thread starter KISHOR KABADI
  • Start date Start date
K

KISHOR KABADI

Guest
when i trying to convert date in following format

dd/MM/yy
dd/MMM/yy
dd/MM/yyyy
dd/MMM/yyyy
MM/dd/yy
MMM/dd/yy
MM/dd/yyyy
MMM/dd/yyyy
MMM/yyyy
yy/MMM
yyyy/MMM
yy/MM/dd
yy/MMM/dd
yyyy/MM/dd
yyyy/MMM/dd

date is converted into following format

dd-MM-yy
dd-MMM-yy
dd-MM-yyyy
dd-MMM-yyyy
MM-dd-yy
MMM-dd-yy
MM-dd-yyyy
MMM-dd-yyyy
MMM-yyyy
yy-MMM
yyyy-MMM
yy-MM-dd
yy-MMM-dd
yyyy-MM-dd
yyyy-MMM-dd

but i am expecting result in following format with en-IN Culture..

dd/MM/yy
dd/MMM/yy
dd/MM/yyyy
dd/MMM/yyyy
MM/dd/yy
MMM/dd/yy
MM/dd/yyyy
MMM/dd/yyyy
MMM/yyyy
yy/MMM
yyyy/MMM
yy/MM/dd
yy/MMM/dd
yyyy/MM/dd
yyyy/MMM/dd


code is:

CultureInfo culture = new CultureInfo("en-IN");

DateTime dt = Convert.ToDateTime("02-01-2019", culture);

string result dt.ToString("dd/MMM/yyyy");

result is 02-Jan-2019


Expected result is 02/Jan/2019

Continue reading...
 
Back
Top