Typing the current date without the time

Hey guys

I need to type date on yyyy-mm-dd format
And I’m using DateTime.Now
And it’s gave the wrong date

Actually it types the minutes in mm instead of the month

I need an expression gives me the date in that format without the time

Hope you can help I’m getting stuck

Thanks

1 Like

Hello @N_Qahtani and welcome the community :partying_face:

Try the following:
system.DateTime.Now.ToString(“yyyy-MM-dd”)

Also - check out this link to understand the differences between ‘M’ and ‘m’:

Hopefully this helps

4 Likes

Hi Mate,

Use System.DateTime.now.toString(“yyyy-MM-dd”).

Hope it helps,
Thanks and regards.

@N_Qahtani,

also you can use

Now.ToShortDateString
Now.ToLongDateString

1 Like

@N_Qahtani

Check as below for your reference
Convert Date & Time Format Tutorial

Hope this helps you

Thanks

Hi @N_Qahtani
Welcome to Uipath Community!

Actually, you are using the correct command that needs only small changes, when you use DateTime.Now its returns date + time
so you need only date , you have to made the expression of frunt as you need (yyyy-mm-dd)
and you can change any position of like (mm-yyyy-dd) will show you the year on middle

Correct code : system.DateTime.Now.ToString(“yyyy-MM-dd”)
Main.xaml (4.3 KB)

Hello use

Datetime.now.tostring(“yyyy-MMM-dd”)

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