How to convert the date to USA format

Hi all,

I want to convert the dates like 11/02/2002 and 24/04/1993 (Indian format) to USA format like 02/24/1993 and 04/24/1993.

Please someone help me.

@Palaniyappan
@ppr
@nikhil.girish
@lakshman
@Sudharsan_Ka
@geetishree.rao

Thanks

1 Like

Hi @HeartCatcher ,

That can be easily achieved by using the DateTime.ParseExact method like so →
image

DateTime.ParseExact(str_date,"dd/MM/yyyy",Nothing).ToString("MM/dd/yyyy")

Kind Regards,
Ashwin A.K

@HeartCatcher

Can you please check your query once.

You want month first and then date right ?

1 Like

Yes month first

Hi,

FYI, another solution:

yourString = "24/04/1993"

Then

System.Text.RegularExpressions.Regex.Replace(yourString,"(\d{2})/(\d{2})","$2/$1")

Regards,

1 Like

Hi @HeartCatcher

if you want month first then here you go

DateTime.ParseExact(your variable,"dd/MM/yyyy",Nothing).ToString("MM/dd/yyyy")

so this helps you in getting the desired output

if at all you need year first and next month kindly change last part accordingly

Cheers!!
happy automation

1 Like

Hi @HeartCatcher

if you dont have any queries on this
kinldy close the topic @HeartCatcher

Happy Learning :slight_smile: @HeartCatcher

@HeartCatcher

You can try any one of the solution suggested by others.

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