Date is not displaying in this format (dd/MM/yy)

Date is not displaying in this format (dd/MM/yy)
Actual this is my date which i have stored in excel sheet: 07-09-2015
and i want to display this date into message box
i am using this method to display the date: row.Item(“BIRTH_DATE”).ToString.Replace("/","")
this is the output which i am getting
image

Input: 07-09-2015
Expected output: 07092015
Actual output what i am getting now:
image

How to implement this?

Thanks :slight_smile:

Hi

Fine then use this expression in message box

Datetime.ParseExact(row.Item(“BIRTH_DATE”).ToString.SubString(0,10),”MM/dd/yyyy”,System.Globalization.CultureInfo.InvariantCulture).ToString(“ddMMyyyy”)

Cheers @NervousTuber

1 Like

yeah i am already using this , but i am not getting expected output which i need

i need to display this date “07-09-2015” into “07092015” this format…

image
not like this

I have updated the previous comment
Pls check

@NervousTuber

Thanks for your help <3 its working fine

Never format date by string replace, use proper globalization!

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