Convert date time format



Dear all,

I have value cell below:


when get and show it. The value is “11/23/2017 0:00”.
Now, i want to convert it to format “MMdd”.
I tried use CDate(DateTime_v).ToString(“MMdd”) or DateTime.ParseExact(BuyDate_v.ToString, “MMdd”, enUS, DateTimeStyles.None).
But it is not correct. Please help to check.

Thank you.


@AKY try this Convert.ToDateTime(ur variable name).ToString(“MMdd”)


Hi @Manjuts90,

I tried by this way and i have the result below.
1/27/1903 0:00
Not the right time i need.
Do you have another help?

Thank you


Hi @AKY,

Try below code.

DateTime.ParseExact(BuyDate_v.ToString, "MM/dd/yyyy h:ss", System.Globalization.CultureInfo.InvariantCulture).ToString("MMdd")



Hi @arivu96,

I tried with your help.
And have error below:


So i think value BuyDate_v.ToString when i got was not correct.
I message box again and the value right of BuyDate_v.ToString is “11/23/2017 00:00:00” .
So, how can i change “MM/dd/yyyy h:ss” to correct?


Hi @AKY,

you told above format.

Try below Code.

DateTime.ParseExact(BuyDate_v.ToString, "MM/dd/yyyy hh:mm:ss", System.Globalization.CultureInfo.InvariantCulture).ToString("MMdd")



Hi @arivu96,

After convert, this is the result:

1/27/1903 12:00:00 AM.

I don’t know how it content “AM”.
Please help to check.

Thank you