Solved All months of year=30 (1 Viewer)

FahadTiger

Member
Local time
Today, 11:39
Joined
Jun 20, 2021
Messages
115
Hi Expert..
Is there a function through which all months can be considered to have 30 days, so that when I subtract a first date from a second date, the months are considered to have 30 days? so i get the Result of days
I can do it with a query but can it do it with vba
thank you All
 

Gasman

Enthusiastic Amateur
Local time
Today, 09:39
Joined
Sep 21, 2011
Messages
14,336
No , why would there be? :(
 

plog

Banishment Pending
Local time
Today, 03:39
Joined
May 11, 2011
Messages
11,653
o i get the Result of days

I don't understand that exactly. But hey, has that ever stopped anyone on this forum? Use the DateDiff to find total days:


RemainingDays: DateDiff("d", [StartDate], [EndDate]) MOD 30

Then get the remainder when you divide by 30 using MOD.

 

moke123

AWF VIP
Local time
Today, 04:39
Joined
Jan 11, 2013
Messages
3,926
Hi Expert..
Is there a function through which all months can be considered to have 30 days, so that when I subtract a first date from a second date, the months are considered to have 30 days? so i get the Result of days
I can do it with a query but can it do it with vba
thank you All
just curious, why wouldn't you want the actual number of days?
 

FahadTiger

Member
Local time
Today, 11:39
Joined
Jun 20, 2021
Messages
115
RemainingDays: DateDiff("d", [StartDate], [EndDate]) MOD 30
it works perfect when difference up to 3 months ..but it less than 30 days when difference between 1 to 3 months
 

FahadTiger

Member
Local time
Today, 11:39
Joined
Jun 20, 2021
Messages
115
Will this work?
no...
1679619860599.png
 

plog

Banishment Pending
Local time
Today, 03:39
Joined
May 11, 2011
Messages
11,653
I don't understand, what do you expect from the example you listed. Better yet, give me expectations for these 5 examples:

2022-01-01, 2022-01-29
2022-01-01, 2022-01-30
2022-01-01, 2022-01-31
2022-01-01, 2022-02-01
2022-01-01, 2023-01-01
 

FahadTiger

Member
Local time
Today, 11:39
Joined
Jun 20, 2021
Messages
115
You are right..but my client has a lot of workers and he wants to count 30 days per month to calculate salaries..this is how the agreement with them..honestly, I did not come across such an agreement

thank you plog

don't understand, what do you expect from the example you listed
 

Users who are viewing this thread

Top Bottom