How to get current system date in mm/dd/yyyy format?

Hi Guys,

How to get current system date in mm/dd/yyyy format ?

Thanks,
Vishal Kumar

2 Likes

Hi @vishal.kumar

Approaches can be many, here is the simplest one.

Dateinformatsample.xaml (6.3 KB)

1 Like

Hi Viswanath,

This approach sounds good. How can i add 30 days to the system date obtained?

eg: system date: 11/21/2017 and I want the date to be set as 30 days from today i.e 12/21/2017

Thanks,
Vishal kumar

Hai @vishal.kumar

Please find the updated .xaml file.

Let me know if u have any queries on the same.

Dateinformatsample.xaml (6.3 KB)

1 Like

@vishal.kumar try this Convert.toDateTime(now.tostring(“MM/dd/yyyy”)).AddDays(30).ToString

Update: use this now.AddDays(30).tostring(“MM/dd/yyyy”) it will give you desired result “12/21/2017” instead of “12/21/2017 00:00:00”

5 Likes

Hi @vishal.kumar ,

Lets try this as mentioned @AkshaySandhu .

3 Likes

Try this:
System.DateTime.Now.ToString(“MM/dd/yyyy”)

7 Likes

Vishal whenever I try to do something in UIpath why is that I have to hit google and search, rather than working on own, what language does Uipath take into account for these functions

2 Likes

That’s how programming works :wink: Just Google everything, put it together and make it work.

The language is C#.

4 Likes

I don’t think that is how it works in other automation tools, it takes a lot of interest out

Please dont take me wrong, does that mean we need to learn basics of C#?

I would certainly recommend it, it makes a lot of stuff a lot easier. It is not required to use the software though.

Hi,
I want to get system date in " Feb’ 20 " format. can anyone please help me with this.

1 Like

@Dasharath Try This Now.ToString(“MMM\'yy”)

1 Like

Thank you, worked well for me .

1 Like

Hi @vishal.kumar
Here is what you´re looking for.

assign this to a variable : System.DateTime.Now.ToString(“MM/dd/yyy”)

1 Like

Please see this video to learn more about data formatting in UiPath:

Video: UiPath | Date Formatting | Convert date to String | Get date format | yyyy.MM.dd | dd.MM.yyyy - YouTube

Best regards
Mahmoud

1 Like