1

Topic: Determination of number of days in a month (VBS)

Hello
how it is possible on VBS to define number of days in specific month of specific year?

2

Re: Determination of number of days in a month (VBS)

s_year = 2000
s_month = 2
MsgBox Day (DateAdd ("d",-1, DateSerial (s_year, s_month + 1, 1)))

3

Re: Determination of number of days in a month (VBS)

Even is easier

MsgBox Day (DateSerial (s_year, s_month + 1, 0))

4

Re: Determination of number of days in a month (VBS)

Shocker. Pro wrote:

even is easier

MsgBox Day (DateSerial (s_year, s_month + 1, 0))

the trick with the last zero, did not know

5

Re: Determination of number of days in a month (VBS)

big-duke wrote:

Nichose the trick with the last zero, did not know

aha, too did not know to a pore, as arguments for DateSerial it is possible to write that got, for example 13th month is a January next year, it is possible to set the negative values also

6

Re: Determination of number of days in a month (VBS)

For the sake of interest, found an initial topic. It is Misha of an eye opened. Also that you would think, a topic... About an amount of days in a month smile))
http://www.sql.ru/forum/751086/pomogite … dateserial

7

Re: Determination of number of days in a month (VBS)

Shocker. Pro, I THANK!
Prompt please still how to transform a title of month to its number?

8

Re: Determination of number of days in a month (VBS)

In what language the title of month will be written, and whether regional settings Windows will certainly coincide with this language?

9

Re: Determination of number of days in a month (VBS)

Shocker. Pro, the title of month is written in RUSSIAN
The regional coincide

10

Re: Determination of number of days in a month (VBS)

PUT_2012;
And a title short -  or long - January?

11

Re: Determination of number of days in a month (VBS)

s_month = "February"
MsgBox Month (CDate ("1" BOTH s_month AND "-2000"))

12

Re: Determination of number of days in a month (VBS)

PUT_2012;

Sub GetDateFromStr_RU ()
Dim sSource As String
Dim lM As Long
sSource = "on April, 16th 1999"
lM = Val (InStr (1, "", Mid (sSource, InStr (1, sSource, "", 1) + 1, 3), 1) + 2) / 3
MsgBox DateSerial (Right (sSource, 4), lM, Left (sSource, 2))
End Sub

But the date format always should be as above with a year from 4 digits. Otherwise it is necessary .

13

Re: Determination of number of days in a month (VBS)

big-duke, a title long - MAY, DECEMBER....

14

Re: Determination of number of days in a month (VBS)

Shocker. Pro, I THANK!!!
The variant offered by you is worked!
And what is necessary the code if the title of months is in Russian and system language will be English?

15

Re: Determination of number of days in a month (VBS)

Well then only through the reference manual, one of variants offered The_Prist

16

Re: Determination of number of days in a month (VBS)

Only with May there it is necessary to be defined

17

Re: Determination of number of days in a month (VBS)

Shocker. Pro, checked up by the machine where system language English.
Your code too works.
Can you were mistaken  adjustments?

18

Re: Determination of number of days in a month (VBS)

PUT_2012 wrote:

Shocker. Pro, checked up by the machine where system language English.

system language can also English, and regional settings, quite possibly, Russian

19

Re: Determination of number of days in a month (VBS)

Prompt still please how to learn an amount of the last days current month?

20

Re: Determination of number of days in a month (VBS)

Day ()
Whether it is time to take in hands the reference manual on functions VB?

21

Re: Determination of number of days in a month (VBS)

Shocker. Pro, advise IDE for a spelling and debugging of code VBS

22

Re: Determination of number of days in a month (VBS)

PUT_2012 wrote:

Shocker. Pro, advise IDE for a spelling and debugging of code VBS

why only I? smile)) I on VBS do not write, I do not know.