Convert "MM/dd/yy" to "dd/MM/yyyy"

when i am using this expression DateTime.ParseExact(DOB_AA.ToString(),“dd/MM/yyyy”,Globalization.CultureInfo.InvariantCulture).ToString(“MM/dd/yyyy”) i am faccing problem like this
please help me
image
image
thanks

1 Like
  • Change Date into DateTime
  • Change Globalization.CultureInfo.InvariantCulture into System.Globalization.DateTimeFormatInfo.InvariantInfo

@Vivek_Kumar3

Datetime.Parse Exact(“your input date”,“your input date format”,System.Globalization.cultureinfo.invariantculture).tostring(“MM/dd/yyyy”)

Example:
Datetime.Parse Exact(“05/27/2019”,“dd/MM/yyyy”,System.Globalization.cultureinfo.invariantculture).tostring(“MM/dd/yyyy”)

Thanks,
Aman.

Hi,
Thanks for Replying
but ur given expression giving me same issue
any other way to change pls suggest me

Can you please send me your date format how you are getting?

What is DOB_AA Data Type?

Hi
Hope this expression would help your resolve this
Datetime.Parse Exact(DOB_AA.ToString().SubString(0,10),“dd/MM/yyyy”,System.Globalization.cultureinfo.invariantculture).tostring(“MM/dd/yyyy”)

Cheers @Vivek_Kumar3

1 Like

string

  1. Are you sure? Why you convert string to string?
  2. What is the value of DOB_AA?

@Vivek_Kumar3
Facing this Error Message IT IS recommended to Check If the datevalue of conversion is valid. Does mean: exists this Date in real?
E.g 31.11.2019 is Not real, due November ends with 30th

Hi @Vivek_Kumar3

try this Cdate(DOB_aa.ToString).ToString(“MM/dd/yyyy”)

Thanks
ashwin S

thanks it is working fine