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

5 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

1 Like

I need help on the attached workflow which calculates total number of days between 2 dates.
Currently it accepts input in MM/dd/yyyy format

I would like to change it to work with user input in dd/MM/yyyy format

Calculate Total Workdays.zip (2.5 KB)

Thank you very much.

I need to convert Jan into-01/01/2022 in all the excel files.How to do it?

DateTime.ParseExact(dt.ToString, “dd.MM.yyyy”, CultureInfo.InvariantCulture)
.ToString(“yyyyMMdd”)

Thank you for this, really helped.

Hi, Could please help me to convert 13th Oct’23 this date in dd/MM/yyyy format?

Hi, @Veeha,

You can use the following code to convert the “13 Oct’23” to “dd/MM/yyyy” format. A small modification you have to do in order to use the code, remove “th”.

Date Convertion : DateTime.ParseExact(inputDate, “dd MMM’yy”, System.Globalization.CultureInfo.InvariantCulture).ToString(“dd/MM/yyyy”)

1 Like

Thanks, one more query regarding date. I am extracting below string from web and i just want a date from that and not time -
WebString - 10/13/20233:31 P.M.

I have tried below regex but not working.
System.Text.RegularExpressions.Regex.Match(SessionTitleVal.ToString,“\d+\W\d+\W\d+”).ToString
output - 10/13/20233 (it is not just extracting date)

Could you please help in this