Issue regarding Date format in Website

Hello All,

Everyone might came across Insurance company website, where we enter From Date and To Date.
Here, When I run the bot from 1st to 5th of every month(1st july-5th July) The date should enter as 1st June to 30th June. And from 6th July it should take the from date and To date as current month. Is it possible?

Yes u can use Today option in assign activity , it will give current machine’s local date
image

You can format the date required in any format by using this

Today.ToString(“yyyy/MM/dd”)
image

Hi @ramshiva_reddy ,

The Short answer is Yes.

But we would like to understand if there were issues from your end in doing so, and the insurance websites differ among many, so we would need to know How is the Date Input element present ?

We can check with the following methods as Initial :

  1. Type Into Activity (Some times we will be able to directly enter the date values instead of choosing)
  2. Set Attribute Activity (we can set the attribute that corresponds to the date value)
  3. Click Activity (When not possible to type into / Set Attribute, With Multiple Clicks we should be able to choose the dates.)

Hello Bro,

Issue from my end. I didn’t get that logic. from 1st to 5th of every month the bot has to enter previous month dates(from- 1st june 2023 and To- 30th junne 2023). Again when it comes to 6th It should write for current month dates rather than previous month.

You can use Today or Now and check whether the day lies between 1st to 5th. If it is, then input it as prev month using AddMonths(-1). Else if its not in that range then use the date as it is

Eg:-

  1. dateList.Contains(now.ToString(“d”)), where dateList ia {1,2,3,4,5}. If its true then, from is (01,now.month,now.year).AddMonths(-1) and to is (30,now.month,now.year).AddMonths(-1).

  2. If its false then, from is (01,now.month,now.year) and to is (30,now.month,now.year).

  3. Last date of prev Month new DateTime(now.Year,now.Month,1).AddDays(-1)
    Last date of current Month new DateTime(now.Year,now.Month,1).AddMonth(1).AddDays(-1)

@ramshiva_reddy
Could you provide an example so that it will be easy to write the logic.
Regards,

@ramshiva_reddy ,

The Date Calculation can be done in the below way for your case :

You can use an If condition to Check if the Current Day is within 1 to 5 and then assign the dates accordingly :
Condition to Check :

DateTime.Now.Day>=1 andAlso DateTime.Now.Day<=5

In then Part :

startDate  = DateTime.Now.AddMonths(-1).ToString("01/MM/yyyy")

endDate = DateTime.Now.AddDays(-DateTime.Now.Day).ToString("dd/MM/yyyy")

In the Else Part :

startDate  = DateTime.Now.ToString("01/MM/yyyy")

endDate = DateTime.Now.AddMonths(1).AddDays(-DateTime.Now.Day).ToString("dd/MM/yyyy")

Here startDate and endDate are String type variables.

Hi @ramshiva_reddy

Have attached the below workflow based on the requirement.

Sequence4.xaml (9.9 KB)

Hope it might help you.
Regards,

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