How to convert string format from (12/31/9999 00:00:00) to (31.12.9999)

Hi,

I have string value as (12/31/9999 00:00:00) and want to convert into (31.12.9999).

Can someone please help

@Palaniyappan

Thanks,
Naresh

@Mandava_Naresh

datetime.ParseExact("12/31/9999 00:00:00","MM/dd/yyyy hh:mm:ss",system.Globalization.CultureInfo.InvariantCulture).ToString("dd.MM.yyyy")

Hi @Shiva_Nikhil

you can use this

CDate("12/31/9999 00:00:00").ToString("dd/MM/yyyy hh:mm:ss")

Hi @Mandava_Naresh

Can you try this

inputDate = “12/31/9999 00:00:00”
parsedDate = DateTime.ParseExact(inputDate, “MM/dd/yyyy HH:mm:ss”, System.Globalization.CultureInfo.InvariantCulture)
outputDate = parsedDate.ToString(“dd.MM.yyyy”)

Hope this helps

@Shiva_Nikhil … It worked.
Thank you very much

1 Like

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