Date formatting issue occurred

Hello,

In above shows image i want to type from date and today date but last two three days bot run properly but now the date format has changed his typing like 0001

Thanks

@suraj_gaikwad

the Format should be dd-MMM-yyyy or for few UI’s hyphen is not needed then ddMMMyyyy

cheers

@Anil_G

It’s not working I tried both with hyphen and without hyphen

@suraj_gaikwad

Can you put in a writeline activity and check what is your output?
Also, check if the selector is getting valid? also check can you type the date manually in that date box?

Use Set Text activity also and try as Now.Tostring(“dd-MMM-yyyy”)

Hope this may help you

Thanks,
Srini

Out put is coming like this but i don’t how bcz sometime it’s worked nicely now it’s showing issued like this

@Anil_G @Srini84

Hi @suraj_gaikwad

Can you tell me one thing, is your in_FromDate is coming from any other input file? OR that is Now.Tostring?

Thanks,
Srini

@Srini84
System.date time

@suraj_gaikwad

I see value of in_FromDate … is already wrong…that might be because you are not passing any value to the required argument…please check that

Depending on in_FromDate the value of ToString is decided

cheers

No actually I’m providing system date

@Anil_G @Srini84

@suraj_gaikwad

Check below


By default the System.DateTime value variable will return the 01/01/0001

So if you have any value then check that you are passing that correctly

Hope this may help you

Thanks,
Srini

@suraj_gaikwad

It is clear here

image

Would request you to please recheck

cheers

1 Like

@suraj_gaikwad

Check that you are passing arguments correctly

Thanks,
Srini

1 Like

HI @suraj_gaikwad

Use system.datetime.today

1 Like

Actually I have to pass the 01-jun-2015
How should I passed this date bcz sometime bot is taking properly date and sometimes like this

@supriya117 @Anil_G @Srini84

@suraj_gaikwad

Then directly pass the value only if it is constant…

The problem here is your datetime variable…if the date is constant as 01-Jan-2015 then pass it as a string as ways instead of datetime

cheers

1 Like

But I have to continue change the variable type den it’s working without any hardcore value

@Anil_G @Srini84 @supriya117

Try :
if (DateTime.TryParseExact(yourdateString, “dd-MMM-yyyy”, CultureInfo.InvariantCulture, DateTimeStyles.None, out date))
{
string formattedDate = date.ToString(“dd-MMM-yyyy”, CultureInfo.InvariantCulture);
Console.WriteLine(formattedDate)
}

Note: date is a datetime type variable here and replace yourdateString with your actual string value

1 Like

@suraj_gaikwad

You have to clarify which is the value you sent earlier because if you send todays date there is no way you get 01-Jan-2015 as the output date

One thing you can do is use Cdate("01/01/2015") as input date so that you need not change the datatypes

cheers

1 Like

@Srini84 @supriya117 @Anil_G @BBarik_Dev

Hello,

Issued solve but when bot will run new date that it’s working properly den I have to change the variable of data type whenever I’m running the bot 2/3/4 time and I have to closed the UiPath and re-open den it will run

Thanks

@suraj_gaikwad

Try these:

  1. Clear cache and temporary files
  2. Update UiPath and dependencies if there any
  3. Make sure that the previous instances of the bot are terminating properly. Check for any background tasks related to the bot that might be preventing subsequent runs.
  4. Ensure that your machine has sufficient resources to run multiple instances of the bot simultaneously.