Get a date in formart "dd/mm/yyyy"

Hi Madhuraj,
I have a dt(variable) with format “dd.MM.yyyy”, and I want to use your method to convert it into a new format to"yyyyMMdd".
I tried with assign NewDT=Convert.ToDateTime(dt.ToString(“yyyyMMdd”)), system always come up with a complier error reminder.
Please help to take a look and help me on this.

Thanks.

Hi Sir,

What if I begin with a variable dt instead of today?
I tried both dt.ToString(“yyyyMMdd”, System.Globalization.CultureInfo.InvariantCulture) and DateTime.dt.ToString(“yyyyMMdd”, System.Globalization.CultureInfo.InvariantCulture), neither of them works.

Hey @Allen_Huang

Try to use this and lemme know.

DateTime.ParseExact("your Input Date String", "dd.MM.yyyy", CultureInfo.InvariantCulture)
                  .ToString("yyyyMMdd")

Regards…!!
Aksh

4 Likes

Dear,

Thanks for your reply, I have fixed this through other way.

Here is a detailed article on that :slight_smile:

Regards,

1 Like

Hi , I’m new to Uipath trying to fetch date from mail using item.Header(“Date”) ,the output comes in the format of Thu 02/27/2020 8:00am and I want to convert the mail date format to System date format i.e 02/27/2020

Please help.

@Samuel_Sugur1 You can use item.Header(“Date”).ToString.Substring(4,10) - this will give you 02/27/2020

Hi @TimK, I tried using this syntax but i thing this syntax is wrong.

image

what does the error say - hover over blue icon

Try .ToString at the end also.

Still shows error -Header is not the member of System.Net.mail.message

item.Headers(“Date”).ToString.Substring(4,10)

missed the s from Headers :slight_smile:
Try that

2 Likes

Hi!

I try with your metod but in the month always show “00”

CDate(CurrentRow(“Date of Birth”).ToString.Trim).ToString(“dd/mm/yyyy”)

Can you help me?

Hi @Ozkar_Nava ,
Try below code
CDate(CurrentRow(“Date of Birth”).ToString.Trim).ToString(“dd/MM/yyyy”)

Regards,
Arivu