Hi,
I need to take a particular date from the present month how to get the particular date example I have given below please look into it once.
Example: Present month of 15th (15/05/2023)
if the current date is <=15th I need to do some condition.
Please help me to find out the solution.
Thanks
Anil_G
(Anil Gorthi)
2
@copy_writes
If you want to check if the current date is less than required date…and if you want to compre only the day part then use as below
Now.day < 15
If you need to compre with specific date
Then Now < Cdate("15/05/2023")
Cheers
yes I did that but after condition match I have to set some rage
if
- |
If today’s date is <= 15th of the month, set range to: 16th of previous month to end of month. |
- |
If today’s date is > 15th of the month, set range to 1st through 15th of current month. |
How to do this? help me in this
Anil_G
(Anil Gorthi)
4
@copy_writes
In what range dates are there is it know?
If yes then use the range in the then side and else side as needed
Cheers
I don’t understand what you’re saying.
Anil_G
(Anil Gorthi)
6
@copy_writes
May I know what range you wan to set? And where?
Can you please show it visually
Cheers
No I just assign the value into the variable.
Example if it is <= 15 of present month then assign the value (04/01/2023 - 04/30/2023) into the date_range variable
or
if it is > 15 of present month then assign the value (05/01/2023 - 05/15/2023) into the date_range variable
Cheers
Anil_G
(Anil Gorthi)
8
@copy_writes
May I know what is the variable type of your daterange…is it string
To get the previous month range use this
For first of previous month - Now.Addmonths(-1).ToString("MM/01/yyyy")
For last day of previous month
Cdate(Now.ToString("MM/01/yyyy")).Adddays(-1).ToString("MM/dd/yyyy")
First date of current month - Now.ToString("MM/01/yyyy")
15 of current month - Now.ToString("MM/15/yyyy")
You can combine them as you need
Cheers
Cheers
1 Like
dotbot
(Dhanraj Shetty)
9
Try This
StartDate = If(Now.Day>15,Now.AddDays(-(Now.Day-1)),Now.AddMonths(-1).AddDays(-(Now.Day-1)))
EndDate = If(Now.Day>15,DateTime.ParseExact(“15”+Now.ToString(“/MM/yyyy”),“dd/MM/yyyy”,Nothing),DateTime.ParseExact(DateTime.DaysInMonth(Now.AddMonths(-1).Year,Now.AddMonths(-1).Month).ToString+Now.AddMonths(-1).ToString(“/MM/yyyy”),“dd/MM/yyyy”,Nothing))
Yes, this also I work I tried in a different way
1 Like
system
(system)
Closed
11
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.