Hi can anybody tell the how i can calculate date difference of 2week
i am accessing date from queue using reframework perfomer i have to calulate the date diffrent in week with current system date
You can use the DateDiff function.
Example
Syntax: DateDiff(DateInterval, Date1,Date2)
Code: DateDiff(DateInterval.Day, “2022-01-30”,“2022-05-30”)
It will return the number of the days between the two dates as Integer Type.
Hope It helps!
Regards
Gokul
You can also try with this following @Sandhya_Gajare
intTotalDays = (EndDate - StartDate).TotalDays
EndDate, StartDate are DateTime variables.
Regards
Gokul
can i get code plz bz i am accessing date from queue and i have check if hire date>2week or not
@Gokul001 plz help me out
Hi @Sandhya_Gajare ,
Could you maybe provide us with an example ? It would be helpful for us to decide on the method to be used for the solution.
okay I have hire date colunm in excel i added it into queue i am accessing hire date from queue what i need to do is i have to calculate the difference from 2week suppose i have employee who hired before two week means emphiredate>2week then i can not proceed that emplyee if emphiredate<2week then i have take that emplyee infomation which is stored in another excel sheet and add into third excel
From the Statement, it is understood that you are comparing Current Date to the Date from Excel, In that case we could convert the Date from Excel to a DateTime type and then compare the two dates like below :
(Now.Date-CDate(varDateFromExcel).Date).TotalDays
The above Expression gives you the Number of Days between the two dates. For 2 weeks, then number of days would be 14, Hence we could make a comparison using it.
(Now.Date-CDate(varDateFromExcel).Date).TotalDays>14
In case an error is caught when CDate()
is used, do let us know the hire Date string format, so we could use DateTime.ParseExact()
to parse the date for the format received.
can you provide me code plz
if possible you are somewhat right but
1.first i am adding that excel date to orchestrator queue using dispatcher with reframework
2.i am fetching that date from orchestator queue using performer with orchestatror queue
3.compaire hire date with current system date
4.check if hire date>2week no process
5.if hire date<2week process data
plz help me with code
I believe the First two points are already known and implemented. If not let me know where you are facing issue.
The remaining steps is as What I had provided in the post above.
- Assuming hire date is already stored in a String variable., say
hireDate
. - Using an If Activity we could perform this Step
(Now.Date-CDate(hireDate).Date).TotalDays > 14
Hello @Sandhya_Gajare
Either you can do this with expression or you can use Modify Date activity to achieve the same.
https://docs.uipath.com/activities/docs/modify-date
Thanks
my final date in dd/mm/yyyy format my orginal date in mm/dd/yyyy
HCMJoinersAssignment1Performer.zip (1.1 MB)
This is my code now anybody help me out
Thank you so much
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.